﻿
var orderid;

var comparameters = "3|1|0";

var m_tagbox="#tag_box";

var m_orderid="";

var m_payOrderid="";

var m_yaDanRemind='<div class="window_dialog window_dialog_merge2"><i class="top"></i><div class="window_dialog_info"><p>受%压单原因最多21个字最多21个字最多21个字原因%影响，您的订单将会特殊处理。</p><p>点击“确认等待”，您的订单预计在%<b>7~14</b>个工作日后%进行处理；如果您提交订单%<b>20</b>天后%未确认等待，系统将自动取消您的订单。</p><p>由此给您带来的不便，敬请谅解。</p></div></div>';

//$替换掉

function Position(x, y)
{
  this.X = x;
  this.Y = y;
    
  this.Add = function(val)
  
  {
    var newPos = new Position(this.X, this.Y);
    if(val != null)
    {
      if(!isNaN(val.X))
        newPos.X += val.X;
      if(!isNaN(val.Y))
        newPos.Y += val.Y
    }
    return newPos;
  }
  
  this.Subtract = function(val)
  {
    var newPos = new Position(this.X, this.Y);
    if(val != null)
    {
      if(!isNaN(val.X))
        newPos.X -= val.X;
      if(!isNaN(val.Y))
        newPos.Y -= val.Y
    }
    return newPos;
  }
  
  this.Min = function(val)
  {
    var newPos = new Position(this.X, this.Y)
    if(val == null)
      return newPos;
    
    if(!isNaN(val.X) && this.X > val.X)
      newPos.X = val.X;
    if(!isNaN(val.Y) && this.Y > val.Y)
      newPos.Y = val.Y;
    
    return newPos;  
  }
  
  this.Max = function(val)
  {
    var newPos = new Position(this.X, this.Y)
    if(val == null)
      return newPos;
    
    if(!isNaN(val.X) && this.X < val.X)
      newPos.X = val.X;
    if(!isNaN(val.Y) && this.Y < val.Y)
      newPos.Y = val.Y;
    
    return newPos;  
  }  
  
  this.Bound = function(lower, upper)
  {
    var newPos = this.Max(lower);
    return newPos.Min(upper);
  }
  
  this.Check = function()
  {
    var newPos = new Position(this.X, this.Y);
    if(isNaN(newPos.X))
      newPos.X = 0;
    if(isNaN(newPos.Y))
      newPos.Y = 0;
    return newPos;
  }
  
  this.Apply = function(element)
  {
    if(typeof(element) == "string")
      element = document.getElementById(element);
    if(element == null)
      return;
    if(!isNaN(this.X))
      element.style.left = this.X + 'px';
    if(!isNaN(this.Y))
      element.style.top = this.Y + 'px';  
  }
}

function hookEvent(element, eventName, callback)
{
  if(typeof(element) == "string")
    element = document.getElementById(element);
  if(element == null)
    return;
  if(element.addEventListener)
  {
    element.addEventListener(eventName, callback, false);
  }
  else if(element.attachEvent)
    element.attachEvent("on" + eventName, callback);
}

function unhookEvent(element, eventName, callback)
{
  if(typeof(element) == "string")
    element = document.getElementById(element);
  if(element == null)
    return;
  if(element.removeEventListener)
    element.removeEventListener(eventName, callback, false);
  else if(element.detachEvent)
    element.detachEvent("on" + eventName, callback);
}

function cancelEvent(e)
{
  e = e ? e : window.event;
  if(e.stopPropagation)
    e.stopPropagation();
  if(e.preventDefault)
    e.preventDefault();
  e.cancelBubble = true;
  e.cancel = true;
  e.returnValue = false;
  return false;
}

function getEventTarget(e)
{
  e = e ? e : window.event;
  return e.target ? e.target : e.srcElement;
}

function absoluteCursorPostion(eventObj)
{
  eventObj = eventObj ? eventObj : window.event;
  
  if(isNaN(window.scrollX))
    return new Position(eventObj.clientX + document.documentElement.scrollLeft + document.body.scrollLeft, 
      eventObj.clientY + document.documentElement.scrollTop + document.body.scrollTop);
  else
    return new Position(eventObj.clientX + window.scrollX, eventObj.clientY + window.scrollY);
}

function dragObject(element, attachElement, lowerBound, upperBound, startCallback, moveCallback, endCallback, attachLater)
{
  if(typeof(element) == "string")
    element = document.getElementById(element);
  if(element == null)
      return;
  
  if(lowerBound != null && upperBound != null)
  {
    var temp = lowerBound.Min(upperBound);
    upperBound = lowerBound.Max(upperBound);
    lowerBound = temp;
  }

  var cursorStartPos = null;
  var elementStartPos = null;
  var dragging = false;
  var listening = false;
  var disposed = false;
  
  function dragStart(eventObj)
  { 
    if(dragging || !listening || disposed) return;
    dragging = true;
    
    if(startCallback != null)
      startCallback(eventObj, element);
    
    cursorStartPos = absoluteCursorPostion(eventObj);
    
    elementStartPos = new Position(parseInt(element.style.left), parseInt(element.style.top));
   
    elementStartPos = elementStartPos.Check();
    
    hookEvent(document, "mousemove", dragGo);
    hookEvent(document, "mouseup", dragStopHook);
    
    return cancelEvent(eventObj);
  }
  
  function dragGo(eventObj)
  {
    if(!dragging || disposed) return;
    
    var newPos = absoluteCursorPostion(eventObj);
    newPos = newPos.Add(elementStartPos).Subtract(cursorStartPos);     
    
    newPos = newPos.Bound(lowerBound, upperBound)
    newPos.Apply(element);
    if(moveCallback != null)
      moveCallback(newPos, element, eventObj);
        
    return cancelEvent(eventObj); 
  }
  
  function dragStopHook(eventObj)
  {
    dragStop();
    return cancelEvent(eventObj);
  }
  
  function dragStop()
  {
    if(!dragging || disposed) return;
    unhookEvent(document, "mousemove", dragGo);
    unhookEvent(document, "mouseup", dragStopHook);
    cursorStartPos = null;
    elementStartPos = null;
    if(endCallback != null)
      endCallback(element);
    dragging = false;
  }
  
  this.Dispose = function()
  {
    if(disposed) return;
    this.StopListening(true);
    element = null;
    attachElement = null
    lowerBound = null;
    upperBound = null;
    startCallback = null;
    moveCallback = null
    endCallback = null;
    disposed = true;
  }
  
  this.StartListening = function()
  {
    if(listening || disposed) return;
    listening = true;
    hookEvent(attachElement, "mousedown", dragStart);
  }
  
  this.StopListening = function(stopCurrentDragging)
  {
    if(!listening || disposed) return;
    unhookEvent(attachElement, "mousedown", dragStart);
    listening = false;
    
    if(stopCurrentDragging && dragging)
      dragStop();
  }
  
  this.IsDragging = function(){ return dragging; }
  this.IsListening = function() { return listening; }
  this.IsDisposed = function() { return disposed; }
  
  if(typeof(attachElement) == "string")
    attachElement = document.getElementById(attachElement);
  if(attachElement == null)
    attachElement = element;
    
  if(!attachLater)
    this.StartListening();
}

var StringBuilder = function(){
    this.cache = [];
    if(arguments.length)this.append.apply(this,arguments);
}
StringBuilder.prototype = {
    prepend:function(){
        this.cache.splice.apply(this.cache,[].concat.apply([0,0],arguments));
        return this;
    },
    append:function(){
        this.cache = this.cache.concat.apply(this.cache,arguments);
        return this;
    },
    toString:function(){
        return this.getString();
    },
    getString:function(){
        return this.cache.join('');    
    }
}

///2010--10--21
String.prototype.trim=function() 
{ 
    return this.replace(/(\s*$)|(^\s*)/g, '');
};
String.prototype.encodeHtml=function() 
{ 
    return this.replace(/\&/g, "&amp;").replace(/\</g, "&lt;").replace(/\>/g, "&gt;").replace(/\\/g, "&quot;").replace(/\'/g, "＇");
};
///




function IsIE(){
		return ( navigator.appName=="Microsoft Internet Explorer" ); 
}

function IsNav(){
	return ( navigator.appName=="Netscape" );
}
	
function getPosition(o){
	
	var nLt=0;
	var nTp=0;
	var offsetParent = o;
	
	while (offsetParent!=null && offsetParent!=document.body) {
			
			nLt+=offsetParent.offsetLeft;
			nTp+=offsetParent.offsetTop;
	
	if(!IsNav()){		
		parseInt(offsetParent.currentStyle.borderLeftWidth)>0?nLt+=parseInt(offsetParent.currentStyle.borderLeftWidth):"";
		parseInt(offsetParent.currentStyle.borderTopWidth)>0?nTp+=parseInt(offsetParent.currentStyle.borderTopWidth):"";	
		}	
	offsetParent=offsetParent.offsetParent;	
	}
	
	return {x:nLt, y:nTp}; 
}


function hidden()
{  
    var lin = document.getElementById("tag_box");
    if(lin)lin.style.display="none";
}

function hidden_for_cancel()
{  
    var lin = document.getElementById("tag_box");
    if(lin)lin.style.display="none";
}
function hidden_for_callback()
{  
    var lin = document.getElementById("tag_box");
    if(lin)lin.style.display="none";
}




//取消订单1 20110402是否显示添加购物车 is_product_shippingfee
function orderswin(Id,parent_id,orderid,canceltype,parameters,ifcouponpay,is_product_shippingfee)
{

    //var lin =  document.getElementById("tag_box");
    
   // alert(is_product_shippingfee);
       
    var lin =  jQuery(m_tagbox).get(0);
    if(!lin)return;
    lin.innerHTML = cancelOrderJS(parent_id,orderid,canceltype,parameters,ifcouponpay,is_product_shippingfee);

    //var pos = getPosition(document.getElementById(Id));
    
    var pos = jQuery("#"+Id).offset();    

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.left - 300  + "px";
    lin.style.top = pos.top + "px";			
    lin.style.display="block";	  

}

//取消订单2
function cancelOrderJS(parent_id,orderid,canceltype,parameters,ifcouponpay,is_product_shippingfee)
{
        //cancelType   0:订单只有一个包裹，取消订单；1：订单有两个包裹，全部取消；2：订单有两个包裹，取消其中一个 就都取消了。
        
        
 var sb = new StringBuilder('<div id="e1" class="myddorder_popup_wrap myddorder_popup_cancel">');
sb.append('<div id="handle" class="myddorder_popup">');
sb.append('<div class="myddorder_popup_title"><h2>取消订单</h2><a href="javascript:hidden();" class="close" title="关闭">关闭</a></div>');

if(canceltype == '0')//非分包裹订单取消
{
        if(ifcouponpay==0)
        {       
           
            sb.append('<div class="myddorder_popup_main">');            
            sb.append('<h3 class="icon_warning status1"><i></i><span>您确定取消订单 ',orderid,'？</span></h3>');   
            if(is_product_shippingfee!=1)
            {
               sb.append('<p class="goods_opration"><input type="checkbox" id="ifaddcart" /><label class="goods_opration_text">将订单中的商品重新放入购物车</label></p>');  
            }        
            
            
              sb.append('<div class="myddorder_popup_btn"><button  name="confirm"   id="btn_OrderCancel" onClick=javascritpt:postCancelDate("',orderid,'","',parameters,'");>确 定</button><button  name="cancel"  class="btn2"  onclick="javascript:hidden_for_cancel();" >关 闭</button></div>');  
            
              sb.append('</div> ');     
       
        }
        else
        {            
            sb.append('<div class="myddorder_popup_main">');            
            sb.append('<h3 class="icon_warning status1"><i></i><span>您确定取消订单 ',orderid,'？</span></h3>');   
            
             //sb.append('<p class="tips">温馨提示：您的订单中使用了礼券，取消订单后礼券将在10分钟左右退回您的账户！</p>');    
              if(is_product_shippingfee!=1)
              {       
                sb.append('<p class="goods_opration"><input type="checkbox" id="ifaddcart" /><label class="goods_opration_text">将订单中的商品重新放入购物车</label></p>');  
             }
            
              sb.append('<div class="myddorder_popup_btn"><button name="confirm"  id="btn_OrderCancel" onClick=javascritpt:postCancelDate("',orderid,'","',parameters,'");>确 定</button><button  name="cancel"  class="btn2"  onclick="javascript:hidden();" >关 闭</button></div>');  

            
            sb.append('</div> ');     
        }
   
}
else if(canceltype == '1')
{
      if(ifcouponpay==0)
        {       
           
            sb.append('<div class="myddorder_popup_main">');            
            sb.append('<h3 class="icon_warning status1"><i></i><span>您确定取消订单 ',parent_id,'？</span></h3>');      
            
            sb.append('<p class="tips">温馨提示：您的订单是分包裹发送订单，取消订单后所有包裹都将取消。</p>');      
              
               if(is_product_shippingfee!=1)
               {
                sb.append('<p class="goods_opration"><input type="checkbox" id="ifaddcart" /><label class="goods_opration_text">将订单中的商品重新放入购物车</label></p>'); 
               }
              
           
              sb.append('<div class="myddorder_popup_btn"><button   name="confirm"  id="btn_OrderCancel" onClick=javascritpt:postCancelDate("',orderid,'","',parameters,'");>确 定</button><button  name="cancel"  class="btn2"  onclick="javascript:hidden();" >关 闭</button></div>');  

            
            sb.append('</div> ');     
       
        }
        else
        {            
            sb.append('<div class="myddorder_popup_main">');            
            sb.append('<h3 class="icon_warning status1"><i></i><span>您确定取消订单 ',parent_id,'？</span></h3>');   
            
            sb.append('<p class="tips">温馨提示：您的订单是分包裹发送订单，取消订单后所有包裹都将取消。</p>');  
            
             //sb.append('<p class="tips">温馨提示：您的订单中使用了礼券，取消订单后礼券将在10分钟左右退回您的账户！</p>');    
             if(is_product_shippingfee!=1)
             {
              sb.append('<p class="goods_opration"><input type="checkbox" id="ifaddcart" /><label class="goods_opration_text">将订单中的商品重新放入购物车</label></p>');  
             }       
           
           
              sb.append('<div class="myddorder_popup_btn"><button  name="confirm"  id="btn_OrderCancel" onClick=javascritpt:postCancelDate("',orderid,'","',parameters,'");>确 定</button><button  name="cancel"  class="btn2"  onclick="javascript:hidden();" >关 闭</button></div>');  

          
            sb.append('</div> ');     
        }
}
else 
{
        if(ifcouponpay==0)
        {       
           
            sb.append('<div class="myddorder_popup_main">');            
            sb.append('<h3 class="icon_warning status1"><i></i><span>您确定取消订单 ',orderid,'？</span></h3>');  
            
            sb.append('<p class="tips">温馨提示：您的订单是分包裹发送订单，取消订单后所有包裹都将取消。</p>');   
              if(is_product_shippingfee!=1)
              {
              sb.append('<p class="goods_opration"><input type="checkbox" id="ifaddcart" /><label class="goods_opration_text">将订单中的商品重新放入购物车</label></p>');  
              }       
            
            
              sb.append('<div class="myddorder_popup_btn"><button  name="confirm"  id="btn_OrderCancel" onClick=javascritpt:postCancelDate("',orderid,'","',parameters,'");>确 定</button><button  name="cancel"  class="btn2"  onclick="javascript:hidden();" >关 闭</button></div>');  

          
            sb.append('</div> ');     
       
        }
        else
        {            
            sb.append('<div class="myddorder_popup_main">');            
            sb.append('<h3 class="icon_warning status1"><i></i><span>您确定取消订单 ',orderid,'？</span></h3>');   
            
             sb.append('<p class="tips">温馨提示：您的订单是分包裹发送订单，取消订单后所有包裹都将取消。</p>');  
            
             //sb.append('<p class="tips">温馨提示：您的订单中使用了礼券，取消订单后礼券将在10分钟左右退回您的账户！</p>');    
            
             if(is_product_shippingfee!=1)
              {        
               sb.append('<p class="goods_opration"><input type="checkbox" id="ifaddcart" /><label class="goods_opration_text">将订单中的商品重新放入购物车</label></p>');  
            }
            
              
              sb.append('<div class="myddorder_popup_btn"><button  name="confirm"   id="btn_OrderCancel" onClick=javascritpt:postCancelDate("',orderid,'","',parameters,'");>确 定</button><button  name="cancel"  class="btn2"  onclick="javascript:hidden();" >关 闭</button></div>');  

           
            sb.append('</div> ');     
        }

}
//sb.append('<input class="w_cancel" onclick=javascript:hidden();  type="button" value="否" />	</div>');

sb.append('<\/div>');

    return sb.getString();


}

//取消订单3
function postCancelDate(orderid,parameters)
{  
//        alert(jQuery("#ifaddcart").get(0))
//        alert(jQuery("#ifaddcart").get(0)==undefined);
//        return;
        
         if(jQuery("#ifaddcart").get(0)!=undefined)
         {
           if(jQuery("#ifaddcart").get(0).checked)
           {     
            cancel_to_addshopcart(orderid);
           }   
         } 
         
    var outputDataUrl = "./outputData.aspx";

    //var parsStr = "?Dtype=cancelorder&Id=" + orderid  + "&d="  + new Date();
    
    var myurl = outputDataUrl;
         		    
   	 
    
    comparameters =  parameters;    
    // var aAjax = XMLHttp._sendRequest('GET', myurl, '', true, "text/xml", renderCancelFun)
     
     //jquery
     
     jQuery.get(myurl,{modify:"true",Dtype:"cancelorder",Id:orderid,d:new Date(),from:"list"},
         function(data)
                    {
                       var tex =data;	   
                                   // var lin =  document.getElementById("tag_box"); 
                                     var lin =  jQuery(m_tagbox).get(0);
                                              
                                    if(tex == "") 
                                    {
                                    return;
                                    }    
                                   else if(tex!="ok"&&tex!="error")
                                   {           
                                        hidden();
                                   
                                        //lin.innerHTML = surveyWindow_for_cancelorder(tex); 
                                        
                                        jQuery(lin).html(surveyWindow_for_cancelorder(tex)); 
                                        
                                        
                                        new dragObject(lin, "handle", null, null, null, null, null, false);             


                                            var sta = comparameters.split("|");
                                            if(sta[0] == 0) 
                                            {
                                            loadData_forsucceedorder('payorder',comparameters,'true');
                                             //loadData('payorder',comparameters);   
                                            }
                                            else
                                            {
                                            loadData_searchOrder('searchorder',comparameters,0);
                                            //loadData_forsucceedorder('order',comparameters,'true');
                                            // loadData('order',comparameters);
                                            }   
                                        lin.style.display="block";     
                                        
                                        windowMoveToCenterfororderlistsurvey();
                                   }
                                   else
                                   {
                                     var text="订单取消成功！";     
                                    jQuery(lin).html(cancelSuccJS(text)); 
                                     
                                            var sta = comparameters.split("|");
                                            if(sta[0] == 0) 
                                            {
                                             //loadData('payorder',comparameters); 
                                             loadData_forsucceedorder('payorder',comparameters,'true');  
                                            }
                                            else
                                            {
                                             //loadData('order',comparameters);
                                              loadData_forsucceedorder('order',comparameters,'true');
                                            }     
                                    lin.style.display="block";    
                                   }   
                    }
         );
     
     //jquery

}



//订单取消后成功页    //取消订单5
function surveyWindow_for_cancelorder(survey_url)    
{
    var sb = new StringBuilder('<div id="e1" width="auto">');
    
      sb.append('<div id="handle">');      
      sb.append('<\/div>');
          
     sb.append('<iframe onLoad="iFrameHeight()"  src="',survey_url,'" style="width:830px;" frameborder="0" scrolling="no"   name="survey_frame" id="survey_frame" ></iframe>');
     sb.append('<\/div>'); 
     
     return sb.getString();
}


    function iFrameHeight() 
    { 
        var ifm= document.getElementById("survey_frame"); 
        var subWeb = document.frames ? document.frames["survey_frame"].document : ifm.contentDocument; 
        if(ifm != null && subWeb != null) 
        { 
            ifm.height = subWeb.body.scrollHeight; 
            
        } 
    }



///取消订单 成功后的方法

function cancelSuccJS(text)
{     

//   var sb = new StringBuilder('<div id="e1" class="new_window">');
//    sb.append('<div id="handle" class="wind_top">');
//    sb.append('<div  class="title_left">取消订单<\/div>');
//    sb.append('<div class="w_close"><a href=javascript:hidden();><img src="images\/windo_close.gif" title="关闭窗口" \/><\/a><\/div>');
//    sb.append('<\/div>');

//    sb.append('<div class="w_ok_use">',text,'<\/div>');
//    sb.append('<div style="height:50px"><input class="button_close" name="" onClick=javascript:hidden(); type="button" value="关闭窗口" \/><\/div>');
//   
//    sb.append('<\/div>');

//    return sb.getString();
    
    
     var sb = new StringBuilder('<div id="e1" class="myddorder_popup_wrap  myddorder_popup_cancel">');    
     sb.append('<div id="handle"  class="myddorder_popup">');
     
    sb.append('<div class="myddorder_popup_title">');
    sb.append('<h2>取消订单</h2><a href="javascript:hidden();" class="close" title="关闭">关闭</a>');
    sb.append('</div>');
    
    sb.append('<div class="myddorder_popup_main">');
    sb.append('<h3 class="icon_none"><span>谢谢反馈！</span></h3>');
    //sb.append('<p>想了解退款方式及所需时间 ，<a href="http://support.dangdang.com/helpcenter/api_cms/helpcenter/question_sort/2242/180107.shtml" target="_blank">请点击&gt;&gt;</a></p>');    
    sb.append('<div class="myddorder_popup_btn"><button onclick="javascript:hidden_for_cancel();">关闭窗口</button></div>');
    sb.append('<\/div>');
   
     sb.append('<\/div>');
     sb.append('<\/div>');

    return sb.getString();
}


///20100429 显示 二手书 人的联系方式
function showC2cContactInfo(shopname,shopid)
{
    var outputDataUrl = "./outputData.aspx";

    var parsStr = "?modify=true&shopid=" + shopid  + "&d="  + new Date();
    var myurl = outputDataUrl + parsStr ;
         		    
     
     var aAjax = XMLHttp._sendRequest('GET', myurl, '', true, "text/xml", renderCCinfo)
}


function renderCCinfo(originalRequest)
{
    var tex = originalRequest.responseText;	             
    if(tex == "") return;    
    else
    {
      var lin =  document.getElementById("tag_box");
      var a=tex.split("|")[0];
      var b=tex.split("|")[1];
      
       var sb = new StringBuilder('<div id="e1" class="new_window">');

    sb.append('<div id="handle" class="wind_top">');
    sb.append('<div  class="title_left">',a,'的联系方式<\/div>');
    sb.append('<div class="w_close"><a href=javascript:hidden();><img src="images\/windo_close.gif" title="关闭窗口" \/><\/a><\/div>');
    sb.append('<\/div>');

    //sb.append('<div class="w_ok_use">',b,'<\/div>');
    
    sb.append('<div class="window_content window_subpack">')
    sb.append('<div class="wind_split">')
    sb.append(' <p>',b,'<\/p>')
    sb.append(' <\/div>')
    sb.append('<input class="split_ok" name="input3" type="button" onclick=javascript:hidden_for_c2c(); value="关 闭" \/>')
    sb.append(' <\/div>')
    
    
//    <div class="window_content window_subpack">
//		<div class="wind_split">
//          <p>手机：13111234567</p>
//          <p>QQ：1234567891</p>
//        </div>
//        <input class="split_ok" name="input3" type="button" value="关 闭" />
//    </div>
   
    sb.append('<\/div>');   
      
      
     lin.innerHTML = sb.getString();
     
     //"<div>"+a+"的联系方式</div><br/>"+"<div>xxxxxx："+b+"</div>";
     
      var pos = getPosition(document.getElementById("showC2cInfo"));

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.x - 26  + "px";
    lin.style.top = pos.y  - 100 + "px";			
    lin.style.display="block";	
    }
  
   
     
   
}
function hidden_for_c2c()
{
      var lin = document.getElementById("tag_box");
    if(lin)lin.style.display="none";

}



///20100429

///收货评价begin  20110315

//收货评价 1

function JsOpenwin_Evaluation(Id,parameters,type,lparameters,receiver_city_id,symbol)
{

    //var lin =  document.getElementById("tag_box");    
    var lin =  jQuery(m_tagbox).get(0)
    
    var sta = parameters.split(":");
    comparameters = lparameters;
        
    jQuery(lin).html(callBackJS_Evaluation(sta[0],sta[1],sta[2],sta[3],receiver_city_id,symbol));

        
    var pos = jQuery("#"+Id).offset();

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.left - 260  + "px";
    lin.style.top = pos.top + "px";	
    lin.style.zIndex = 2;			
    lin.style.display="block";	 
    
    //added by lsp 2011-11-30 日期弹出框背景不可编辑
    jQuery(".ddnewhead_search_panel").css("zIndex","3");
    jQuery(".ddnewhead_help").css("zIndex","3");
    jQuery(".ddnewhead_mydd").css("zIndex","3");
    jQuery(".ddnewhead_gcard").css("zIndex","3");
    

}



//收货评价 2

function callBackJS_Evaluation(orderid,sStartD,indate,succeed_order_num,receiver_city_id,symbol)
{
    var sb = new StringBuilder('<div  id="e1"  class="myddorder_popup_wrap">');      
    sb.append(' <div  id="handle" class="myddorder_popup myddorder_calendar">');    
    sb.append(' <div class="myddorder_popup_title">');    
     sb.append(' <h2>订单 ',orderid,' 收货反馈<\/h2><a href=javascript:hidden(); class="close" title="关闭">关闭<\/a>');    
    sb.append('<\/div>');  
    
    
    sb.append('<div class="myddorder_popup_main">');
    
    sb.append('<p class="feedback_title">感谢您在当当网购物！您的反馈将用以改善我们的服务。（完成反馈可获得5个积分）<\/p>');  
    
    sb.append('<p class="text01"><span>请选择收货日期：<\/span><input onclick=javascript:showCalendar("alendar",false,"InDate",null,null,"',sStartD,'","',indate,'"); id="InDate" type="text" value="',indate,'" \/><a href=javascript:showCalendar("alendar",false,"InDate",null,null,"',sStartD,'","',indate,'"); target="_self" onMouseOut=window.status=""; onMouseOver=window.status="Calendar";return true;><span id="alendar">date<\/span><\/a>  <\/p>');
    sb.append('<p><span></span></p>');
 
    sb.append('<div class="clear"><\/div>');
    sb.append(' <div class="myddorder_popup_btn"><button name="submit" onclick="javascritpt:postDate_Evaluation(\'',orderid,'\',\'',succeed_order_num,'\',\'',receiver_city_id,'\',\'',symbol,'\');">提 交<\/button><\/div>');
    sb.append('<\/div> ');
    sb.append('<\/div>');
    sb.append('<\/div>');
       
    return sb.getString();

}

///实际的收货评价 3  AJAX 方式
function postDate_Evaluation(Id,succeed_order_num,receiver_city_id,symbol)
{
///
  var speed="0";
  var attitude="0";
  var package_quality="0";
  var other_review="0";
  
    orderid = Id;
    

    var outputDataUrl = "./outputData.aspx"; 
    
    var myurl = outputDataUrl;
         		    
    var pars = "";	   	  
   
   if(symbol==0)  ///正常订单
   {       
       //jquery
     jQuery.get(myurl,{modify:"true",Dtype:"callback_Evaluation",from:"list",Id:Id,num:succeed_order_num,cityid:receiver_city_id,d:new Date(),att:attitude,spe:speed,pac:package_quality,rev:escape(other_review)},
     function(data)
                {
                  
                   var tex = data;	        
                    if(tex == "") return;                    
                    //var lin =  document.getElementById("tag_box");
                    var lin =  jQuery(m_tagbox).get(0); 
                    
                    if(tex !="error" && tex !="ok")
                    {
                        //lin.innerHTML = surveyWindow(tex);
                        
                        jQuery(lin).html(surveyWindow(tex));
                        
                        new dragObject(lin, "handle", null, null, null, null, null, false);
                        //loadData('order',comparameters);
                         loadData_forsucceedorder('order',comparameters,'true');
                        lin.style.display="block";
                        //windowMoveToCenter();
                        windowMoveToCenterfororderlistsurvey();
                    }
                    else
                    {
                        var repstr ="感谢您的反馈，此订单积分将于15天后记入您的帐户。"
                        if(tex == "error") repstr = "提交失败，请稍候再试！";
                        
                        //lin.innerHTML = callEdJS(orderid,repstr);
                        
                        jQuery(lin).html(callEdJS_Evaluation(orderid,repstr));
                        
                        
                        new dragObject(lin, "handle", null, null, null, null, null, false);  
                        lin.style.display="block";
                       // loadData('order',comparameters);
                         loadData_forsucceedorder('order',comparameters,'true');
                    }
                  
                   
                }
     );
     //jquery
   }
   else //二手书订单 ordertype=60
   {    
      
      //jquery
        jQuery.get(myurl,{modify:"true",Dtype:"callback",Id:Id,de:indate,num:succeed_order_num,cityid:receiver_city_id,d:new Date()},
         function(data)
                    {
                       var tex = data;	        
                                if(tex == "") return;
                                
                                var lin =  jQuery(m_tagbox).get(0);
                                
                                if(tex !="error" && tex !="ok")
                                {
                                    
                                     jQuery(lin).html(surveyWindow(tex));
                                    new dragObject(lin, "handle", null, null, null, null, null, false);
                                    
                                    loadData_forsucceedorder('order',comparameters,'true');
                                    lin.style.display="block";
                                   
                                    windowMoveToCenterfororderlistsurvey();
                                }
                                else
                                {
                                    var repstr ="感谢您的反馈"
                                    if(tex == "error") repstr = "提交失败，请稍候再试！";
                                    
                                    //lin.innerHTML = callEdJS(orderid,repstr);
                                    jQuery(lin).html(callEdJS_Evaluation(orderid,repstr));
                                    
                                    new dragObject(lin, "handle", null, null, null, null, null, false);  
                                    lin.style.display="block";
                                    //loadData('order',comparameters);
                                     loadData_forsucceedorder('order',comparameters,'true');
                                }
                     
                    }
         );
      
      //jquery
   }  

}
//收货评价 3

function callEdJS_Evaluation(orderid,text){

    
     var sb = new StringBuilder('<div id="e1" class="myddorder_popup_wrap">');
     
     sb.append('<div id="handle" class="myddorder_popup">');
     
      sb.append('<div class="myddorder_popup_title">');
      
      sb.append('<h2>订单 ',orderid,' 收货反馈</h2><a href=javascript:hidden(); class="close" title="关闭">关闭</a>');
      
      sb.append('</div>');
      
      sb.append('<div class="myddorder_popup_main">');
      
      sb.append('<h3 class="icon_success status2"><i></i><span>提交成功</span></h3>');
      sb.append('<p class="tips">温馨提示：此订单的积分将在15天退换货期后计入您的帐户。</p>');
      sb.append('<div class="myddorder_popup_btn"><button  onclick="javascript:hidden_for_callback();writeProductsComm('+orderid+');" >写评价赚积分</button></div>');
     
     
      sb.append('</div>');
       sb.append('</div>');
        sb.append('</div>');
        
     
     return sb.getString();   

}

///收货评价end



function  writeProductsComm(orderid)
{
  //var  jump_url="http://comm.dangdang.com/shopreview/review_post_success.php?order_id="+orderid+"&ref=order ";
  var  jump_url="http://comm.dangdang.com/review/comment.php?order_id=" + orderid + "&ref=order ";
  
  window.open (jump_url, '写评价赚积分', 'height=800, width=800, top=0, left=0, toolbar=yes,menubar=yes, scrollbars=yes, resizable=yes,location=yes') ;
}








//收货反馈1
function JsOpenwin(Id,parameters,type,lparameters,receiver_city_id,symbol)
{

    //var lin =  document.getElementById("tag_box");    
    var lin =  jQuery(m_tagbox).get(0)
    
    var sta = parameters.split(":");
    comparameters = lparameters;
    //lin.innerHTML = callBackJS(sta[0],sta[1],sta[2],sta[3],receiver_city_id,symbol);
    
    jQuery(lin).html(callBackJS(sta[0],sta[1],sta[2],sta[3],receiver_city_id,symbol));

    //var pos = getPosition(document.getElementById(Id));
    
    var pos = jQuery("#"+Id).offset();

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.left - 260  + "px";
    lin.style.top = pos.top + "px";	
    lin.style.zIndex = 2;	
    lin.style.display="block";	 
    
    //added by lsp 2011-11-30 日期弹出框背景不可编辑
    jQuery(".ddnewhead_search_panel").css("zIndex","3");
    jQuery(".ddnewhead_help").css("zIndex","3");
    jQuery(".ddnewhead_mydd").css("zIndex","3");
    jQuery(".ddnewhead_gcard").css("zIndex","3");

}

//收货反馈2
function callBackJS(orderid,sStartD,indate,succeed_order_num,receiver_city_id,symbol)
{
    var sb = new StringBuilder('<div  id="e1"  class="myddorder_popup_wrap">');      
    sb.append(' <div  id="handle" class="myddorder_popup myddorder_calendar">');    
    sb.append(' <div class="myddorder_popup_title">');    
     sb.append(' <h2>订单 ',orderid,' 收货反馈<\/h2><a href=javascript:hidden(); class="close" title="关闭">关闭<\/a>');    
    sb.append('<\/div>');
    
    
    
    sb.append('<div class="myddorder_popup_main">');
    
    sb.append('<p class="feedback_title">感谢您在当当网购物！您的反馈将用以改善我们的服务。（完成反馈可获得5个积分）<\/p>');
    
    sb.append('<p class="text01"><span>请选择收货日期：<\/span><input onclick=javascript:showCalendar("alendar",false,"InDate",null,null,"',sStartD,'","',indate,'"); id="InDate" type="text" value="',indate,'" \/><a href=javascript:showCalendar("alendar",false,"InDate",null,null,"',sStartD,'","',indate,'"); target="_self" onMouseOut=window.status=""; onMouseOver=window.status="Calendar";return true;><span id="alendar">date<\/span><\/a>  <\/p>');
    
    sb.append('<p><span></span></p>');
    sb.append('<div class="clear"><\/div>');
    sb.append(' <div class="myddorder_popup_btn"><button name="submit" onclick="javascritpt:postDate(\'',orderid,'\',\'',succeed_order_num,'\',\'',receiver_city_id,'\',\'',symbol,'\');">提 交<\/button><\/div>');
    sb.append('<\/div> ');
    sb.append('<\/div>');
    sb.append('<\/div>');
       
    return sb.getString();

}


//有焦点后
function shownull()
{
  
    document.getElementById("receive_review_content").innerHTML="";
  
     var aCtrl = document.getElementById("receive_review_content");
        if (aCtrl.setSelectionRange) {
            setTimeout(function() {
                    aCtrl.setSelectionRange(0, 0);  
                    aCtrl.focus();
            }, 0);
        }else if (aCtrl.createTextRange) {
            var textArea=document.getElementById("receive_review_content");
            var tempText=textArea.createTextRange();

            tempText.moveEnd("character",0-tempText.text.length);
            tempText.select();
        }

  
}

//失去焦点
function showword()
{
  if(document.getElementById("receive_review_content").value=="") 
  document.getElementById("receive_review_content").innerHTML="最多允许输入200个汉字";  
}

///////////////////////非常不满意、不满意、一般、满意、非常满意

function onmovechangestar_speed(score)
{
    var _temp_score = parseInt(score,10);
    var _info="";
    for(var j=5;j>=1;j--)
    {
        var sel_obj_old = document.getElementById("img_speed_"+j);
        if (sel_obj_old){
            sel_obj_old.className="off";
        }
    }
    for(var i=5;i>=score;i--)
    {
        var sel_obj = document.getElementById("img_speed_"+i);
        if (sel_obj){
            sel_obj.className= "on";
        }
    }

    switch(_temp_score){
        case 5:
            _info="非常不满意";  //非常差、挺差、一般、还好吧、很好
            break;
        case 4:
            _info="不满意";
            break;
        case 3:
            _info="一般";
            break;
        case 2:
            _info="满意";
            break;
        case 1:
            _info="非常满意";
            break;
    }
    var div_score_info = document.getElementById("div_speed_info");
    if(div_score_info)
        div_score_info.innerHTML=_info;
}


function chk_speed(score){
    var _temp_score = parseInt(score,10);
    var _info="";
    for(var j=5;j>=1;j--)
    {
        var sel_obj_old = document.getElementById("img_speed_"+j);
        if (sel_obj_old){
            sel_obj_old.className= "off";
        }
    }
    for(var i=5;i>=score;i--)
    {
        var sel_obj = document.getElementById("img_speed_"+i);
        if (sel_obj){
            sel_obj.className= "on";
        }
    }
    var rd_sel = document.getElementById("input_speed");
    if (rd_sel)
    {
        rd_sel.value=score;
    }
    switch(_temp_score){
        case 5:
            _info="非常不满意"; // //非常差、挺差、一般、还好吧、很好
            break;
        case 4:
            _info="不满意";
            break;
        case 3:
            _info="一般";
            break;
        case 2:
            _info="满意";
            break;
        case 1:
            _info="非常满意";
            break;
    }
    var div_score_info = document.getElementById("div_speed_info");
    if(div_score_info)
        div_score_info.innerHTML=_info;
        
       // alert(div_score_info.innerHTML);
}
//////////////////////


function onmovechangestar(score)
{
    var _temp_score = parseInt(score,10);
    var _info="";
    for(var j=5;j>=1;j--)
    {
        var sel_obj_old = document.getElementById("img_score_"+j);
        if (sel_obj_old){
            sel_obj_old.className="off";
        }
    }
    for(var i=5;i>=score;i--)
    {
        var sel_obj = document.getElementById("img_score_"+i);
        if (sel_obj){
            sel_obj.className= "on";
        }
    }

    switch(_temp_score){
        case 5:
            _info="非常差";  //非常差、挺差、一般、还好吧、很好
            break;
        case 4:
            _info="挺差";
            break;
        case 3:
            _info="一般";
            break;
        case 2:
            _info="还好吧";
            break;
        case 1:
            _info="很好";
            break;
    }
    var div_score_info = document.getElementById("div_score_info");
    if(div_score_info)
        div_score_info.innerHTML=_info;
}


function chk_sock(score){
    var _temp_score = parseInt(score,10);
    var _info="";
    for(var j=5;j>=1;j--)
    {
        var sel_obj_old = document.getElementById("img_score_"+j);
        if (sel_obj_old){
            sel_obj_old.className= "off";
        }
    }
    for(var i=5;i>=score;i--)
    {
        var sel_obj = document.getElementById("img_score_"+i);
        if (sel_obj){
            sel_obj.className= "on";
        }
    }
    var rd_sel = document.getElementById("input_score");
    if (rd_sel)
    {
        rd_sel.value=score;
    }
    switch(_temp_score){
        case 5:
            _info="非常差"; // //非常差、挺差、一般、还好吧、很好
            break;
        case 4:
            _info="挺差";
            break;
        case 3:
            _info="一般";
            break;
        case 2:
            _info="还好吧";
            break;
        case 1:
            _info="很好";
            break;
    }
    var div_score_info = document.getElementById("div_score_info");
    if(div_score_info)
        div_score_info.innerHTML=_info;
        
       // alert(div_score_info.innerHTML);
}


function onmovechangestar_package(score)
{
    var _temp_score = parseInt(score,10);
    var _info="";
    for(var j=5;j>=1;j--)
    {
        var sel_obj_old = document.getElementById("img_package_"+j);
        if (sel_obj_old){
            sel_obj_old.className="off";
        }
    }
    for(var i=5;i>=score;i--)
    {
        var sel_obj = document.getElementById("img_package_"+i);
        if (sel_obj){
            sel_obj.className= "on";
        }
    }

    switch(_temp_score){
        case 5:
            _info="非常不满意";  //非常不满意、不满意、一般、满意、非常满意
            break;
        case 4:
            _info="不满意";
            break;
        case 3:
            _info="一般";
            break;
        case 2:
            _info="满意";
            break;
        case 1:
            _info="非常满意";
            break;
    }
    var div_score_info = document.getElementById("div_package_info");
    if(div_score_info)
        div_score_info.innerHTML=_info;
}


function chk_sock_package(score){
    var _temp_score = parseInt(score,10);
    var _info="";
    for(var j=5;j>=1;j--)
    {
        var sel_obj_old = document.getElementById("img_package_"+j);
        if (sel_obj_old){
            sel_obj_old.className= "off";
        }
    }
    for(var i=5;i>=score;i--)
    {
        var sel_obj = document.getElementById("img_package_"+i);
        if (sel_obj){
            sel_obj.className= "on";
        }
    }
    var rd_sel = document.getElementById("input_package");
    if (rd_sel)
    {
        rd_sel.value=score;
    }
    switch(_temp_score){
        case 5:
            _info="非常不满意"; //非常不满意、不满意、一般、满意、非常满意
            break;
        case 4:
            _info="不满意";
            break;
        case 3:
            _info="一般";
            break;
        case 2:
            _info="满意";
            break;
        case 1:
            _info="非常满意";
            break;
    }
    var div_package_info = document.getElementById("div_package_info");
    if(div_package_info)
        div_package_info.innerHTML=_info;
        
        //alert(div_package_info.innerHTML);
}
///






///实际的收货反馈  AJAX 方式
function postDate(Id,succeed_order_num,receiver_city_id,symbol)
{
///
  var speed="0";
  var attitude="0";
  var package_quality="0";
  var other_review="0";

    orderid = Id;
    
    //var indate =  document.getElementById("InDate").value;    
    
    var indate =jQuery("#InDate").val();      

    var outputDataUrl = "./outputData.aspx";

    //var parsStr = "?Dtype=callback&Id=" + Id  + "&de=" + indate + "&num=" + succeed_order_num + "&cityid=" + receiver_city_id +"&d="  + new Date();    
    //var myurl = outputDataUrl + parsStr ;
    
    var myurl = outputDataUrl;
         		    
    var pars = "";	   	  
   
   if(symbol==0)  ///正常订单
   {
   
      
       
       //jquery
     jQuery.get(myurl,{modify:"true",Dtype:"callback",from:"list",Id:Id,de:indate,num:succeed_order_num,cityid:receiver_city_id,d:new Date(),att:attitude,spe:speed,pac:package_quality,rev:escape(other_review)},
     function(data)
                {
                  
                   var tex = data;	        
                    if(tex == "") return;                    
                    //var lin =  document.getElementById("tag_box");
                    var lin =  jQuery(m_tagbox).get(0); 
                    
                    if(tex !="error" && tex !="ok")
                    {
                        //lin.innerHTML = surveyWindow(tex);
                        
                        jQuery(lin).html(surveyWindow(tex));
                        
                        new dragObject(lin, "handle", null, null, null, null, null, false);
                        //loadData('order',comparameters);
                         loadData_forsucceedorder('order',comparameters,'true');
                        lin.style.display="block";
                        //windowMoveToCenter();
                        windowMoveToCenterfororderlistsurvey();
                    }
                    else
                    {
                        var repstr ="感谢您的反馈，此订单积分将于15天后记入您的帐户。"
                        if(tex == "error") repstr = "提交失败，请稍候再试！";
                        
                        //lin.innerHTML = callEdJS(orderid,repstr);
                        
                        jQuery(lin).html(callEdJS(orderid,repstr));
                        
                        
                        new dragObject(lin, "handle", null, null, null, null, null, false);  
                        lin.style.display="block";
                       // loadData('order',comparameters);
                         loadData_forsucceedorder('order',comparameters,'true');
                    }
                  
                   
                }
     );
     //jquery
   }
   else //二手书订单 ordertype=60
   {
     
      
      //jquery
        jQuery.get(myurl,{modify:"true",Dtype:"callback",Id:Id,de:indate,num:succeed_order_num,cityid:receiver_city_id,d:new Date()},
         function(data)
                    {
                       var tex = data;	        
                                if(tex == "") return;
                                
                                var lin =  jQuery(m_tagbox).get(0);
                                
                                if(tex !="error" && tex !="ok")
                                {
                                    //lin.innerHTML = surveyWindow(tex);
                                     jQuery(lin).html(surveyWindow(tex));
                                    new dragObject(lin, "handle", null, null, null, null, null, false);
                                    //loadData('order',comparameters);
                                    loadData_forsucceedorder('order',comparameters,'true');
                                    lin.style.display="block";
                                   
                                    windowMoveToCenterfororderlistsurvey();
                                }
                                else
                                {
                                    var repstr ="感谢您的反馈"
                                    if(tex == "error") repstr = "提交失败，请稍候再试！";
                                    
                                    //lin.innerHTML = callEdJS(orderid,repstr);
                                    jQuery(lin).html(callEdJS(orderid,repstr));
                                    
                                    new dragObject(lin, "handle", null, null, null, null, null, false);  
                                    lin.style.display="block";
                                    //loadData('order',comparameters);
                                     loadData_forsucceedorder('order',comparameters,'true');
                                }
                     
                    }
         );
      
      //jquery
   }  

}



function surveyWindow(survey_url)
{
    //var sb = new StringBuilder('<div id="e1" class="new_window1">');
    
    var sb = new StringBuilder('<div id="e1" class="new_window1">');
    
    

    sb.append('<iframe   src="',survey_url,'" width="529px" frameborder="0" scrolling="no"   name="survey_frame" id="survey_frame" onload="TuneHeight()"> </iframe>');
    
    //sb.append('<\/div>'); 
    return sb.getString();
}
 

//
function callEdJS(orderid,text){

    
     var sb = new StringBuilder('<div id="e1" class="myddorder_popup_wrap">');
     
     sb.append('<div id="handle" class="myddorder_popup">');
     
      sb.append('<div class="myddorder_popup_title">');
      
      sb.append('<h2>订单 ',orderid,' 收货反馈</h2><a href=javascript:hidden(); class="close" title="关闭">关闭</a>');
      
      sb.append('</div>');
      
      sb.append('<div class="myddorder_popup_main">');
      
      sb.append('<h3 class="icon_success status2"><i></i><span>提交成功</span></h3>');
      sb.append('<p class="tips">温馨提示：此订单的积分将在15天退换货期后计入您的帐户。</p>');
      sb.append('<div class="myddorder_popup_btn"><button  onclick="javascript:hidden_for_callback();writeProductsComm('+orderid+')" >写评价赚积分</button></div>');
      

     
      sb.append('</div>');
       sb.append('</div>');
        sb.append('</div>');
        
     
     return sb.getString();   

}

//call back end


//coupon  start   493
//  这个是礼券激活开始的弹出窗
function couponJS(isok,msg_txt){

    var sb = new StringBuilder('<div id="e1" class="new_window lq_win">');
    
    sb.append('<div id="handle" class="wind_top">');
    sb.append('<div  class="title_left">激活新的购物礼券<\/div>');
    sb.append('<div class="w_close"><a href=javascript:hidden();><img src="images\/windo_close.gif" title="关闭窗口" \/><\/a><\/div>');
    sb.append('<\/div>');
    
    
    sb.append('<div>');
    sb.append('<div class="w_notice">提示：激活是对购物礼券的验证过程，激活后的购物礼券才可以使用。</div>');  
    sb.append('<div class="activ_lq">');    
    sb.append('<div><label>购物礼券号：</label><input class="put_in" maxlength="20" name="input" type="text" id="couponID_input" /> <span  id="couponID_warn"></span></div>');
    sb.append('<div><label>密码：</label><input class="put_in" maxlength="20" name="input" type="password" id="coupon_password_input" /><span id="coupon_password_warn"></span></div>');    
    sb.append('<div><label>验证码：</label><input class="put_in2" maxlength="5" name="input2" type="text" id="vcode_input"  /><img class="vcode" id="imgshowcode" src="VCodeGifShow.aspx?t='+new Date() + '" /><span class="msg"><a href="javascript:changeImage();">看不清，换一张</a></span> <span id="vcode_warn"></span> </div>');
    sb.append('<div><input class="butt_acti" name="input" type="button" onClick="javascript:postCouponDate();" value="激 活" /></div>');
       
    if(isok)
    {
        if(msg_txt==null || msg_txt=="")
        {
            sb.append('<div class="lq_note"><span class="note">本次活动您已激活过一张礼券，谢谢您的参与！</span></div>');
           
        }
        else
        {           
            sb.append('<div class="lq_note"><span class="note">'+ msg_txt + '</span></div>');
        }
    }
    
    sb.append('<div class="clear"></div>');   
    sb.append('<\/div>');

return sb.getString();

}



//  这个是礼券激活成功后的弹出窗
function couponEndJS(text)
{

    var sb = new StringBuilder('<div id="e1" class="new_window lq_win">');

    sb.append('<div id="handle" class="wind_top">');
    sb.append('<div class="title_left">激活新的购物礼券<\/div>');   
    sb.append('<div class="w_close"><a href=javascript:hidden();><img src="images\/windo_close.gif" title="关闭窗口" \/><\/a><\/div>');
    sb.append('<\/div>');
    sb.append('<div>');
    sb.append(' <div class="w_notice">提示：激活是对购物礼券的验证过程，激活后的购物礼券才可以使用。<\/div>');
    sb.append('<div class="activ_lq">');
    sb.append('<div><label>购物礼券号：</label>');
    sb.append('<input class="put_in" maxlength="20" name="input" type="text" id="couponID_input" /><span  id="couponID_warn"></span>');
    sb.append(' </div>');
    sb.append('<div><label>密码：</label>');
    sb.append('<input class="put_in" maxlength="20" name="input" type="password" id="coupon_password_input" /><span id="coupon_password_warn"></span>');
    sb.append(' </div>');
    sb.append('<div><label>验证码：</label>');
    sb.append('<input class="put_in2" maxlength="5" name="input2" type="text" id="vcode_input"  />');    
    sb.append('<img class="vcode" id="imgshowcode" src="VCodeGifShow.aspx?t='+new Date() + '" />');
    sb.append('<span class="msg"><a href="javascript:changeImage();">看不清，换一张</a></span><span id="vcode_warn"></span>');
    sb.append('</div>'); 
    sb.append('<div>');    
    sb.append(' <input class="butt_acti" name="input" type="button" onClick="javascript:postCouponDate();" value="激 活" />');
    sb.append('</div>');    
    sb.append('  <div class="lq_note">');
    sb.append('  <span class="succeed">激活成功！ <a href=\"javascript:hidden();loadData(\'coupon\',\'0|1|0\');\">查看可用购物礼券</a></span>');
    sb.append(' </div>');
    sb.append(' <div class="clear"></div>');
    sb.append(' </div>');
    sb.append(' </div>');
    sb.append(' </div>');    
    return sb.getString();  

}



function JsCouponwin(Id)
{

    var lin =  document.getElementById("tag_box");      
       lin.style.display="none";	     
    lin.innerHTML = couponJS(false);
    //couponEndJS
    //lin.innerHTML = couponEndJS('ddd');
    var pos = getPosition(document.getElementById(Id));
    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.x - 150  + "px";
    lin.style.top = pos.y + "px";			
    lin.style.display="block";	
    
}

function postCouponDate(type)
{
//     sxf='^[A-Za-z0-9]+$';
//     regex=new RegExp(sxf);  
     
    var couponinput =  document.getElementById("couponID_input").value;   
    //alert(couponinput);
   
    var couponID_warn= document.getElementById("couponID_warn");    
    var couponpass =  document.getElementById("coupon_password_input").value;
    var coupon_password_warn= document.getElementById("coupon_password_warn");  
    var txtvcode = document.getElementById("vcode_input");
    var vcode_warn=document.getElementById("vcode_warn");
    var tag_box=document.getElementById("tag_box")
    
    tag_box.innerHTML="";
    tag_box.className="";
    couponID_warn.innerHTML="";
    couponID_warn.className="";
    coupon_password_warn.className=""; 
    coupon_password_warn.innerHTML="";
    vcode_warn.innerHTML="";
    vcode_warn.className="";
    var vcode = "";
    if(txtvcode!=null)
        vcode=txtvcode.value;

    var totalError =  document.getElementById("tag_box");
     
  
    if(couponinput=="")
    {
         if(type=="main")
         {                  
             couponID_warn.className="note"; 
             couponID_warn.innerHTML="请输入购物礼券号！";   
             //document.getElementById("couponID_input").focus();     
         }
         else
         {         
             totalError.innerHTML = couponJS(true,'请输入购物礼券号！');
          }
       return;
    }  
    else 
    { 
       var re=/^[A-Za-z0-9]+$/;
       if(re.test(couponinput)!=true)
      {      
       if(type=="main")
         {                  
             tag_box.className="note"; 
             tag_box.innerHTML="购物礼券号或密码错误，请重新输入！";  
             //document.getElementById("couponID_input").focus();      
         }
         else
         {         
             totalError.innerHTML = couponJS(true,'购物礼券号或密码错误，请重新输入！');
          }
          return;
      }
      
    }  
    
    
    if(couponpass!="")
    //&&(couponinput.indexOf("<")>=0||couponinput.indexOf(">")>=0||couponinput.indexOf("@")>=0||couponinput.indexOf("[")>=0||couponinput.indexOf("&gt")>=0||couponinput.indexOf("]")>=0||couponinput.indexOf("(")>=0||couponinput.indexOf(")")>=0||couponinput.indexOf("&lt;")>=0))
    {
     var re=/^[A-Za-z0-9]+$/;
     
       if(re.test(couponpass)!=true)
       {
           if(type=="main")
             {                  
                 tag_box.className="note"; 
                 tag_box.innerHTML="购物礼券号或密码错误，请重新输入！"; 
                // document.getElementById("coupon_password_input").focus();       
             }
             else
             {         
                 totalError.innerHTML = couponJS(true,'购物礼券号或密码错误，请重新输入！');
              }
              return;
          }
      
    }  
    if(vcode=="")
    {   
        if(type=="main")
         {      
            vcode_warn.className="note";
            vcode_warn.innerHTML="请输入验证码！";
             //document.getElementById("vcode_input").focus();
         }
         else
         {
             totalError.innerHTML = couponJS(true,'请输入验证码！');
          }
          return;
    }
    else 
    //if(vcode.indexOf("<")>=0||vcode.indexOf(">")>=0||vcode.indexOf("@")>=0||vcode.indexOf("[")>=0||vcode.indexOf("&gt")>=0||vcode.indexOf("]")>=0||vcode.indexOf("(")>=0||vcode.indexOf(")")>=0||vcode.indexOf("&lt;")>=0)
    {
        var re=/^[A-Za-z0-9]+$/;
     
       if(re.test(vcode)!=true)
       {
             if(type=="main")
             {      
                tag_box.className="note";
                tag_box.innerHTML="验证码错误！";
                 //document.getElementById("vcode_input").focus();
             }
             else
             {
                 totalError.innerHTML = couponJS(true,'验证码错误！');
              }
              
               return;  
       }
           
    }
    

    var outputDataUrl = "./outputData.aspx";

    var parsStr = "?modify=true&Dtype=couponact&invalue=" + couponinput  + "&ps=" + couponpass +"&vcode="+ vcode + "&d="  + new Date();
    var myurl = outputDataUrl + parsStr ;
         		    
    var pars = "";	   	 
     var functionName ;
    if(type=="main") 
    {
    
     
       var aAjax = XMLHttp._sendRequest('GET', myurl, '', true, "text/xml", renderCouponMainFun);
      
    }
    else    
    {
    
    
    var aAjax = XMLHttp._sendRequest('GET', myurl, '', true, "text/xml", renderCouponFun);
  
    }
}

//得到非弹出窗口激活后,得到的反馈信息的处理
function renderCouponMainFun(originalRequest)
{
              	 			 						 
    var tex = originalRequest.responseText;	  
         
    if(tex == "") return;

    var lin =  document.getElementById("tag_box");
    lin.className="note";
    
    if(tex == "notvcode")
    {
        lin.innerHTML = "请输入验证码！";
    }
    else if(tex == "errorvcode")
    {
        lin.innerHTML = "验证码错误，请重新输入！";
    }    
    else if(tex=="wrong_password")
    {
      lin.innerHTML = "购物礼券号或密码错误，请重新输入！";
    }
      else if(tex=="public_coupon")
    {
      lin.innerHTML = "这是公共礼券，不能激活！";
    }
      else if(tex=="binded_coupon")
    {
      lin.innerHTML = "购物礼券号或密码错误，请重新输入！";
    }   
    //sameserialnum
        else if(tex=="sameserialnum")
    {
      lin.innerHTML = "本次活动您已激活过一张礼券，谢谢您的参与！";
    }   
    
        else if(tex=="you_binded_coupon")
    {
      lin.innerHTML = "此张礼券已激活过，请重新输入！";
    }   
    else if(tex=="datedue")
    {
      lin.innerHTML = "此张购物礼券已过期，请重新输入！";
    }
      else if(tex=="nocoupon")
    {
      lin.innerHTML = "购物礼券号或密码错误，请重新输入！";
    } 
    else
    {
      lin.innerHTML = "当当礼券 " +tex+" 激活成功！";
      loadData("coupon","0|1|0"); 
    }
   
    lin.style.display="block";
 
}

//得到  弹出窗口激活后,得到的反馈信息的处理
function renderCouponFun(originalRequest){
              	 			 						 
    var tex = originalRequest.responseText;	   
    if(tex == "") return;

    var lin =  document.getElementById("tag_box");
    lin.className="note";
    
    if(tex == "notvcode")
    {
        lin.innerHTML = couponJS(true,"请输入验证码！");
    }
    else if(tex == "errorvcode")
    {
        lin.innerHTML = couponJS(true,"验证码错误，请重新输入！");
    }
      else if(tex=="nocoupon")
    {
      lin.innerHTML = couponJS(true,"购物礼券号或密码错误，请重新输入！");
    }
    else if(tex=="wrong_password")
    {
      lin.innerHTML = couponJS(true,"购物礼券号或密码错误，请重新输入！");
    }
    else if(tex=="public_coupon")
    {
      lin.innerHTML = couponJS(true,"这是公共礼券，不能绑定！");
    }
      else if(tex=="binded_coupon")
    {
      lin.innerHTML = couponJS(true,"购物礼券号或密码错误，请重新输入！");
    }
     else if(tex=="sameserialnum")
    {
      lin.innerHTML = couponJS(true,"本次活动您已激活过一张礼券，谢谢您的参与！");
    }   
      else if(tex=="you_binded_coupon")
    {
      lin.innerHTML = couponJS(true,"此张礼券已激活过，请重新输入！");
    }
    else if(tex=="datedue")
    {
      lin.innerHTML = couponJS(true,"此张购物礼券已过期，请重新输入！");
    }
    else
    {
      lin.innerHTML = couponEndJS(tex)
      loadData("coupon","0|1|0"); 
    }
    new dragObject(lin, "handle", null, null, null, null, null, false);
       
    lin.style.display="block";
 
}


//coupon  end



//money start  
function moneyJS(isok,msg_txt){

    var sb = new StringBuilder('<div id="e1" class="new_window">');
    
    sb.append('<div id="handle" class="wind_top">');
    sb.append('<div  class="title_left">激活新的当当礼品卡<\/div>');
    sb.append('<div class="w_close"><a href=javascript:hidden();><img src="images\/windo_close.gif" title="关闭窗口" \/><\/a><\/div>');
    sb.append('<\/div>');

    sb.append('<div class="w_notice">* 提示：激活是对当当礼品卡的验证过程，激活后的当当礼品卡才可以使用。</div>');
    sb.append('<div class="dang_money">当当礼品卡号码：<input id="moneyinput" type="text" value="" /></div>');
    sb.append('<div class="dang_money">当当礼品卡密码：<input id="moneypass" type="password" value="" /></div>');
    
    sb.append('<div class="case_text6"><div class="case_text11">验证码：</div><input id="moneyvcode" class="mall_goods_message_area3" name="input2" type="text" />');
    sb.append('<div class="mall_yanzhengma"><img width ="69px" height ="24px" id="imgshowcode" src="VCodeGifShow.aspx?t='+new Date() + '" /></div>');
    sb.append('<div class="case_shuaxin"><a href="javascript:changeImage()">看不清，换一张</a></div>');
    sb.append('</div>');
    sb.append('<div class=" clear"></div>');
    sb.append('<div style="height:50px"><div align="center"><input class="button_tj" onClick=javascript:postMoneyDate(); name="" type="button" value="激 活" /></div></div>');
    sb.append('<div class="clear"></div>');
    
    if(isok)
    {
        if(msg_txt==null || msg_txt=="")
        {
            sb.append('<div class="notice_fp1"><div align="center">密码或号码不正确！</div></div>');
            //sb.append('<span class="notice_fp">密码或号码不正确！</span></div>');
        }
        else
        {
            //sb.append('<span class="notice_fp">'+ msg_txt + '</span></div>');
            sb.append('<div class="notice_fp1"><div align="center">'+ msg_txt + '</div></div>');
        }
    }

    sb.append('<\/div>');

return sb.getString();

}


function moneyEndJS(text){

    var sb = new StringBuilder('<div id="e1" class="new_window">');

    sb.append('<div id="handle" class="wind_top">');
    sb.append('<div  class="title_left">激活新的当当礼品卡<\/div>');
    sb.append('<div class="w_close"><a href=javascript:hidden();><img src="images\/windo_close.gif" title="关闭窗口" \/><\/a><\/div>');
    sb.append('<\/div>');

   
    sb.append('<div class="w_ok_use">当当礼品卡 ',text,' 已激活。</div>');
   
    sb.append('<div style="height:50px"><input class="button_close" onClick=javascript:hidden(); name="" type="button" value="关闭窗口" /></div>');

    sb.append('<\/div>');

    return sb.getString();

}


function JsMoneywin(Id)
{

    var lin =  document.getElementById("tag_box");      
       lin.style.display="none";	     
    lin.innerHTML = moneyJS(false);
    var pos = getPosition(document.getElementById(Id));

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.x - 150  + "px";
    lin.style.top = pos.y + "px";			
    lin.style.display="block";	
    
}




function postMoneyDate(type)
{

    var moneyinput =  document.getElementById("moneyinput").value;
    var moneypass =  document.getElementById("moneypass").value;
    var txtvcode = document.getElementById("moneyvcode");
    var vcode = "";
    if(txtvcode!=null)
        vcode=txtvcode.value;

    var lin =  document.getElementById("tag_box");
    if(moneyinput=="" || moneypass=="")
    {
     if(type=="main")
     {
        lin.innerHTML = "密码或号码不正确。";
     }
     else
     {
         lin.innerHTML = moneyJS(true);
      }
      return;
    }
    if(vcode=="")
    {
        if(type=="main")
         {
            lin.innerHTML = "请输入验证码！";
         }
         else
         {
             lin.innerHTML = moneyJS(true,'请输入验证码！');
          }
          return;
    }
    

    var outputDataUrl = "./outputData.aspx";

    var parsStr = "?modify=true&Dtype=moneyact&invalue=" + moneyinput  + "&ps=" + moneypass +"&vcode="+ vcode + "&d="  + new Date();
    var myurl = outputDataUrl + parsStr ;
         		    
    var pars = "";	   	 
     var functionName ;
    if(type=="main") 
    {
    
      //var myAjax = new  Ajax.Request(myurl,{method: 'get', parameters: pars, onComplete: renderMoneyMainFun});
       var aAjax = XMLHttp._sendRequest('GET', myurl, '', true, "text/xml", renderMoneyMainFun);
      
    }
    else    
    {
    
    //var myAjax = new  Ajax.Request(myurl,{method: 'get', parameters: pars, onComplete: renderMoneyFun});
    var aAjax = XMLHttp._sendRequest('GET', myurl, '', true, "text/xml", renderMoneyFun);
  
    }
   

}

function renderMoneyFun(originalRequest){
              	 			 						 
    var tex = originalRequest.responseText;	             
    if(tex == "") return;

    var lin =  document.getElementById("tag_box");
    
    if(tex == "notvcode")
    {
        lin.innerHTML = moneyJS(true,"请输入验证码！");
    }
    else if(tex == "errorvcode")
    {
        lin.innerHTML = moneyJS(true,"验证码错误，请重新输入！");
    }
    else if(tex=="error" || tex == "notpass")
    {
      lin.innerHTML = moneyJS(true);
    }
    else if(tex=="notvaliddate")
    {
      lin.innerHTML = moneyJS(true,"当当礼品卡无效。");
    }
    else
    {
      lin.innerHTML = moneyEndJS(tex)
      loadData("money","0|1|0"); 
    }
    new dragObject(lin, "handle", null, null, null, null, null, false);
       
    lin.style.display="block";
 
}

function renderMoneyMainFun(originalRequest){
              	 			 						 
    var tex = originalRequest.responseText;	             
    if(tex == "") return;

    var lin =  document.getElementById("tag_box");
    
    if(tex == "notvcode")
    {
        lin.innerHTML = "请输入验证码！";
    }
    else if(tex == "errorvcode")
    {
        lin.innerHTML = "验证码错误，请重新输入！";
    }
    else if(tex=="error" || tex=="notpass")
    {
      lin.innerHTML = "当当礼品卡密码或号码不正确。";
    }
    else if(tex=="notvaliddate")
    {
      lin.innerHTML = "当当礼品卡无效。";
    }
    else
    {
      lin.innerHTML = "当当礼品卡 " +tex+" 已激活。";
      loadData("money","0|1|0"); 
    }
   
    lin.style.display="block";
 
}

//money  end



function JsPaymentLogResearchwin(Id)
{

    var lin =  document.getElementById("tag_box");      
       lin.style.display="none";	     
    lin.innerHTML = paymentlogResearchJS(false);
    var pos = getPosition(document.getElementById(Id));

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.x - 370  + "px";
    lin.style.top = pos.y - 10  + "px";			
    lin.style.display="block";	
    
}

function paymentlogResearchJS(isok,msg_txt)
{
    var sb = new StringBuilder('<div id="e1" class="window2">');
    
    sb.append('<div id="handle" class="wind_title">');
    sb.append('<div class="title_left">意见反馈</div>');
    sb.append('<div class="window_close"><a href=javascript:hidden();><img src="images/windo_close.gif" title="关闭窗口" /></a></div>');
    sb.append('</div>');
    sb.append('<div class="w_notice_3">您现在看到的是新版“订单支付历史”功能，对此项功能您有任何想法，都欢迎反馈给我们，谢谢！</div>');
    sb.append('<label><textarea name="textarea" id="txtContent" onkeydown ="paymentlogResearchCheckLength(490)"  onkeyup ="paymentlogResearchCheckLength(490)" cols="45" rows="5" class="case_textarea1"></textarea></label>');
    sb.append('<div style="height:50px"><div align="center"><input id="btnSave" onclick="postPaymentlogResearchDate(495)" class="button_tj1" name="input" type="button" value="提 交" /></div></div>');
    
    if(isok)
    {
        if(msg_txt==null ||msg_txt=="")
        {
            sb.append('<div class="notice_fp1"><div align="center">感谢您的反馈</div></div>');
        }
        else
        {
            sb.append('<div class="notice_fp1"><div align="center">'+msg_txt+'</div></div>');
        }
    }
    sb.append('<div class="clear"></div></div>');
    
    return sb.getString();

}

String.prototype.getRealLength=function(){return this.replace(/[^\x00-\xff]/g,"aa").length;};
String.prototype.trim=function() 
{ 
    return this.replace(new RegExp('　','gm'),' ').replace(/(\s*$)|(^\s*)/g, ''); 
} 

function paymentlogResearchCheckLength(len)
{
    var content = document.getElementById("txtContent").value; 
    var objlen = content.getRealLength();
    if(objlen >= len*2)
    {
        //document.getElementById("txtContent").disabled=true;
        document.getElementById("btnSave").disabled=true;
        return false;
    }
    else
    {
        document.getElementById("btnSave").disabled=false;
        return true;
    } 
}

function postPaymentlogResearchDate(len)
{
    var inputresearch = document.getElementById("txtContent").value;
    var lin =  document.getElementById("tag_box");
    
    if(inputresearch=="")
    {
        lin.innerHTML = paymentlogResearchJS(true,'请填写您的意见或建议！');
        return;
    }
    var objlen = inputresearch.getRealLength();
    if(objlen >= len*2)
    {
        lin.innerHTML = paymentlogResearchJS(true,'您的意见或建议过长，请控制在500字内！');
        return;
    }
    
    var outputDataUrl = "./outputData.aspx";
    var parsStr = "?modify=true&Dtype=paymentlogact&d="  + new Date();

    var myurl = outputDataUrl + parsStr ;  
    var pars = "";	   	 
    var functionName ;
    
    var aAjax = XMLHttp._sendRequest('POST', myurl, escape(inputresearch.replace(/</g,"＜")), true, "text/xml", renderPaymentlogResearchFun);

 
}

function renderPaymentlogResearchFun(originalRequest)
{         	 			 						 
    var tex = originalRequest.responseText;	             
    if(tex == "") return;

    var lin =  document.getElementById("tag_box");
    
    if(tex == "2")
    {
        lin.innerHTML = paymentlogResearchJS(true,"请填写您的意见或建议！");
    }
    else if(tex == "1")
    {
        lin.innerHTML = paymentlogResearchJS(true,"对不起，请重新填写您的意见或建议！");
    }
    else
    {
        lin.innerHTML = paymentlogResearchJS(true,"感谢您的反馈！");
    }
    new dragObject(lin, "handle", null, null, null, null, null, false);
       
    lin.style.display="block";
 
} 




function TuneHeight() 
{   
    var frm = document.getElementById("survey_frame");   
    var subWeb = document.frames ? document.frames["survey_frame"].document : frm.contentDocument;   
    if(frm != null && subWeb != null)
    {
        var aa = subWeb.body.scrollHeight;
       frm.height = subWeb.body.scrollHeight;
    }   
}   









function faqaddresswin(Id)
{

    var lin =  document.getElementById("tag_box");   
    if(!lin)return;
    lin.innerHTML = faq();

    var pos = getPosition(document.getElementById(Id));

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.x - 200  + "px";
    lin.style.top = pos.y + "px";			
    lin.style.display="block";	
  

}

function faq()
{

 var sb = new StringBuilder('<div id="e1" class="new_window">');

sb.append('<div id="handle" class="wind_top">');
sb.append('<div  class="title_left">收货地址簿<\/div>');
sb.append('<div class="w_close"><a href=javascript:hidden();><img src="images\/windo_close.gif" title="关闭窗口" \/><\/a><\/div>');
sb.append('<\/div>');


sb.append('<div class="w_notice" style="background-color:#ffffff">');
sb.append('<h3>关于收货地址簿</h3>');
sb.append('<p>Q：常用收货地址有什么用？ </p>');
sb.append('<p>A：如果您设置了常用收货地址，下次下订单的</p><p class="p_bottom">时候，这个地址将作为您订单的收货地址;</p>');
sb.append('<p>Q：地址簿的地址从哪里来？ </p>');
sb.append('<p>A：您在订单中使用过的收货地址将会自动加入</p><p class="p_bottom">收货地址簿，方便您在下次下订单时使用;</p>');
sb.append('<p>Q：地址簿能清空吗？ </p>');
sb.append('<p>A：当然可以，不过如果清空了收货地址簿，下</p><p class="p_bottom">次下订单的时候，您就需要重新填写收货地址了.</p>');
sb.append('</div>');

sb.append('<\/div>');

    return sb.getString();


}

//added by lsp 2011-10-30
function float_product_comment(event)
{
    var x = event.clientX + document.documentElement.scrollLeft - document.body.clientLeft - 96 || event.pageX;
    var y = event.clientY + document.documentElement.scrollTop - document.body.clientTop - 48 || event.pageY;
    float_display(x,y)
}


function float_product_details_comment(event)
{
    var x = event.clientX + document.documentElement.scrollLeft - document.body.clientLeft - 96 || event.pageX;
    var y = event.clientY + document.documentElement.scrollTop - document.body.clientTop - 48 || event.pageY;
    float_display(x,y)
}

function float_product_details_comment_display_default()
{
    var items = jQuery('.tab_w5 .review');
    if(items.length > 0)
    {
        if(items[0] || items[0] != null)
        {
            var pos = getPosition(items[0]);
            var x = pos.x + document.documentElement.scrollLeft - document.body.clientLeft - 96 || pos.x;
            var y = pos.y + document.documentElement.scrollTop - document.body.clientTop - 40 || pos.y;
            float_display(x,y)
        }
    }
}

function float_display(x,y)
{
    jQuery('.order_pop').hide();
    jQuery('.order_pop').css({ 'top': y, 'left': x }).show();
    clearTimeout();
    
    function clearTimeout() {
        setTimeout(function () {
            jQuery('.order_pop').hide();
            }, 2000);
    }
    
    jQuery('.order_pop .close').click(function () {
        jQuery('.order_pop').hide();
    });
}


function float_phone_pop_display()
{
    var items = jQuery('.list_status');
    if(items.length > 0 && items != null && items!="")
    {
       var display_item = items.get(1)
       if( display_item && display_item != null)
        {
            var pos = getPosition(display_item);
            var x = pos.x + document.documentElement.scrollLeft - document.body.clientLeft - 5 || pos.x;
            var y = pos.y + document.documentElement.scrollTop - document.body.clientTop + 12 || pos.y;
            jQuery('.phone_pop').hide();
            jQuery('.phone_pop').css({ 'top': y, 'left': x }).show();
            
            jQuery('.phone_pop .close').click(function () {
			    jQuery('.phone_pop').remove();
		    });
        }
    }
}








function paywin(Id)
{
    var lin =  document.getElementById("tag_box_merge");   
    if(!lin)return;
    lin.innerHTML = pay();

    var pos = getPosition(document.getElementById(Id));

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.x - 10  + "px";
    lin.style.top = pos.y + 10 + "px";			
    lin.style.display="block";	
}
//20101206
function hidden_merge()
{
    var lin =  document.getElementById("tag_box_merge");   
     if(lin)lin.style.display="none";
}



function pay()
{


//       
    
var sb = new StringBuilder('<div class="window_dialog window_dialog_merge">');
sb.append('<i class="top"><\/i>');
sb.append('<div class="window_dialog_info">合并支付是同时对多张订单进行网上支付的一种操作。<\/div>');
sb.append('<\/div>');


    return sb.getString();
//    


}

//20101207
function waitingwin(Id)
{

    var lin =  document.getElementById("tag_box_waiting");   
    if(!lin)return;
    lin.innerHTML = waiting();

    var pos = getPosition(document.getElementById(Id));

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.x - 320  + "px";
    lin.style.top = pos.y + 10 + "px";			
    lin.style.display="block";	
  

}


function hidden_waiting()
{
    var lin =  document.getElementById("tag_box_waiting");   
     if(lin)lin.style.display="none";
}



function waiting()
{
//     
    var sb = new StringBuilder(m_yaDanRemind);
//    sb.append('<i class="top"><\/i>');
//    sb.append('<div class="window_dialog_info">');
//    sb.append('<p>受%压单原因最多21个字最多21个字最多21个字原因%影响，您的订单将会特殊处理。<\/p>');    
//       sb.append('<p>点击“确认等待”，您的订单预计在%<b>7~14<\/b>个工作日后%进行处理；如果您提交订单%<b>20<\/b>天后%未确认等待，系统将自动取消您的订单。<\/p>');
//          sb.append('<p>由此给您带来的不便，敬请谅解。<\/p>');
//             sb.append('<\/div>');
//                sb.append('<\/div>');   

        return sb.getString();
//    


}


function showWaitingDialog(Id,parent_id,orderid,param)
{

 var lin =  jQuery(m_tagbox).get(0);
    if(!lin)return;
    lin.innerHTML = WaitingDialogContent(parent_id,orderid,param);

    
    var pos = jQuery("#"+Id).offset();    

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.left - 150  + "px";
    lin.style.top = pos.top +15 + "px";			
    lin.style.display="block";	    
}

function  WaitingDialogContent(parent_id,orderid,param)
{

   var sb = new StringBuilder(' <div  id="e1"  class="myddorder_popup myddorder_popup_receive">');
    sb.append(' <div  id="handle" class="myddorder_popup_title">');
    sb.append('<h2>订单',parent_id,'<\/h2><a href="javascript:hidden();" class="close" title="关闭">关闭<\/a>');
    sb.append(' <\/div>');    
       sb.append('<div class="myddorder_popup_main">');
          sb.append('<p>此订单预计在%7~14个工作日后%处理</p><p>您确认等待么？</p>');
             sb.append('<div class="myddorder_popup_btn"><button onClick=javascritpt:truePostWaitData("',orderid,'","',param,'","',parent_id,'");>确 定<\/button><button class="btn2" onclick="javascript:hidden();">取 消</button><\/div>');             
             
               sb.append('<\/div>'); 
                sb.append('<\/div>');   

        return sb.getString();   
}


function truePostWaitData(orderid,param,parent_id)
{
    
    
     var outputDataUrl = "./outputData.aspx";       
        
        var myurl = outputDataUrl;        	 
        
        comparameters =  param;    
      
         //jquery
         
         jQuery.get(myurl,{modify:"true",Dtype:"confirmwaitorder",Id:orderid,d:new Date(),from:"list"},
             function(data)
                        {
                                       var tex =data;	   
                                      
                                         var lin =  jQuery(m_tagbox).get(0);
                                                  
                                        if(tex == "") 
                                        {
                                           return;
                                        }    
                                        else if(tex=="ok")
                                        { 
                                             jQuery(lin).html(afterPostWait(parent_id,tex));           
                                          
                                            var sta = comparameters.split("|");
                                            if(sta[0] == 0) 
                                            {
                                            loadData_forsucceedorder('payorder',comparameters,'true');
                                              
                                            }
                                            else
                                            {
                                            loadData_forsucceedorder('order',comparameters,'true');
                                           
                                            }   
                                            lin.style.display="block";     
                                            
                                          
                                       }
                                       else
                                       {
                                            var text="确认等待失败！";     
                                             jQuery(lin).html(afterPostWait(parent_id,"error")); 
                                         
                                            var sta = comparameters.split("|");
                                            if(sta[0] == 0) 
                                            {                                               
                                             loadData_forsucceedorder('payorder',comparameters,'true');  
                                            }
                                            else
                                            {                                                
                                              loadData_forsucceedorder('order',comparameters,'true');
                                            }     
                                            lin.style.display="block";    
                                       }   
                        }
             );
         
     //jquery

   
   
}

function afterPostWait(orderid,tex)
{
  if(tex=="ok")
  {
      var sb = new StringBuilder(' <div   id="e1"  class="myddorder_popup myddorder_popup_receive">');
    sb.append('  <div  id="handle"  class="myddorder_popup_title">');
    sb.append('<h2>订单',orderid,'<\/h2><a href="javascript:hidden();" class="close" title="关闭">关闭<\/a>');
    sb.append(' <\/div>');    
       sb.append('	<div class="myddorder_popup_main">');
          sb.append(' <p>您已经确认等待</p>');
             sb.append('<div class="myddorder_popup_btn"><button  onclick="javascript:hidden();">关闭窗口</button></div>');             
             
               sb.append('<\/div>'); 
                sb.append('<\/div>');   

        return sb.getString();   

  }
  else
  {
     var sb = new StringBuilder(' <div   id="e1"  class="myddorder_popup myddorder_popup_receive">');
    sb.append('  <div  id="handle"  class="myddorder_popup_title">');
    sb.append('<h2>订单',orderid,'<\/h2><a href="javascript:hidden();" class="close" title="关闭">关闭<\/a>');
    sb.append(' <\/div>');    
       sb.append('	<div class="myddorder_popup_main">');
          sb.append(' <p>确认等待失败，请重新尝试！</p>');
             sb.append('<div class="myddorder_popup_btn"><button  onclick="javascript:hidden();">关闭窗口</button></div>');             
             
               sb.append('<\/div>'); 
                sb.append('<\/div>');   

        return sb.getString();   
  }
  
}



//20101207

function getPayData(paytype)
{
var payitems = payData.paymentData;
var len = payitems.length		
		
for(var i=0 ;i < len ;i ++)
{
  //if(payitems[i].payid == paytype) 
  return payitems[i].orderitem;
} 

}

/***************************************************************************************************/
function showMsgText(strHtml,Id,move_x,move_y,is_not_have_shield)
{
    if(strHtml == null || strHtml == "")
    {
        return;
    }

    var lin =  document.getElementById("tag_box");      
       lin.style.display="none";	     
    lin.innerHTML = strHtml;
    
    new dragObject(lin, "handle", null, null, null, null, null, false);
    
    if(Id != null && Id != "" && document.getElementById(Id) != null)
    {
        var pos = getPosition(document.getElementById(Id));
        if(move_x!=null)
        {
            lin.style.left= pos.x - move_x  + "px";
        }
        else
        {
            lin.style.left= pos.x - 150  + "px";
        }
        if(move_y != null)
        {
            lin.style.top = pos.y - move_y + "px";
        }
        else
        {
            lin.style.top = pos.y + "px";
        }
    }
    else if(Id != "")
    {
        windowMoveToCenter();
        window.onscroll = windowMoveToCenter;
    }
    
    //if(is_not_have_shield == null || is_not_have_shield==false)
    //{
    //    showShield();
    //}
    
    lin.style.display="block";
}

var m_is_windowMoveToCenter = false;

function windowMoveToCenter()
{
    var lin =  document.getElementById("tag_box");
    if(document.documentElement)
    {
        if(document.documentElement.clientWidth > 320)
        {
            lin.style.left= ((document.documentElement.clientWidth-320)/2 + document.documentElement.scrollLeft)  + "px";
        }
        else
        {
            lin.style.left= "10px";
        }
        
        if(document.documentElement.clientHeight > 200)
        {
            var xh = (document.documentElement.clientHeight-200)/2 + document.documentElement.scrollTop ;
            lin.style.top= ((document.documentElement.clientHeight-200)/2 + document.documentElement.scrollTop)  + "px";
        }
        else
        {
            lin.style.top= "10px";
        }
    }
    else
    {
        var pos1 = getPosition(document.getElementById("orderList"));
        if(pos1 != null)
        {
            lin.style.left= pos1.x + 229  + "px";
            lin.style.top = pos1.y + 130 + "px";
        }
    }
    m_is_windowMoveToCenter = true;
}

function windowMoveToCenterfororderlistsurvey()
{
    var lin =  document.getElementById("tag_box");
    if(document.documentElement)
    {
        if(document.documentElement.clientWidth > 320)
        {
            lin.style.left= ((document.documentElement.clientWidth-320)/2 + document.documentElement.scrollLeft)  + "px";
        }
        else
        {
            lin.style.left= "10px";
        }
        
        if(document.documentElement.clientHeight > 200)
        {
            var xh = (document.documentElement.clientHeight-200)/2 + document.documentElement.scrollTop ;
            //lin.style.top= ((document.documentElement.clientHeight-200)/2 + document.documentElement.scrollTop)  + "px";
            //alert((document.documentElement.clientHeight-200)/2);
            lin.style.top=((document.documentElement.clientHeight-200)/2 )  + "px";
        }
        else
        {
            lin.style.top= "10px";
        }
    }
    else
    {
        var pos1 = getPosition(document.getElementById("orderList"));
        if(pos1 != null)
        {
            lin.style.left= pos1.x + 229  + "px";
            lin.style.top = pos1.y + 130 + "px";
        }
    }
    m_is_windowMoveToCenter = true;
}

function showOrderPointDetail(Id,source_id)
{
    var outputDataUrl = "./outputData.aspx";
    var parsStr = "?modify=true&Dtype=order_points_detail&Id=" + source_id  + "&d="  + new Date();
    var myurl = outputDataUrl + parsStr ;
    var pars = "";
    obj_points_detail_position_id = Id;
    var aAjax = XMLHttp._sendRequest('GET', myurl, '', true, "text/xml", showOrderPointDetailFun);
}

function showOrderPointDetailFun(originalRequest)
{
    var tex = originalRequest.responseText;
    if(tex != "")
    { showMsgText(tex,obj_points_detail_position_id,0,-15,true); }
}


/******************************************************************************************************/

	
function selcheck() 
{
     //alert(jQuery("input[type=checkbox]"));
      //var objs = document.getElementsByTagName("input");
//      var objs = jQuery("input"); 
//      for(var i=0; i<objs.length; i++) {
//        if(objs[i].type.toLowerCase() == "checkbox" )
//          objs[i].checked = true;
//      }
      jQuery("input[type=checkbox]").attr("checked",true); 
}


function checkAll(obj,paytype)
{
var chk = false;

if(obj.checked)
{
chk = true;
}
var items = getPayData(paytype)
if(!items)return;
var len = items.length						

for(var i=0 ;i < len ;i ++)
{
    
    var ck = jQuery("#ck"+items[i].parentid).get(0);
    if(ck)ck.checked = chk ;
}

    PayCheck(null,paytype);
}


function PayCheck(obj,paytype)
{

    var items = getPayData(paytype)
    if(!items)return;
    var len = items.length	
    var sumPrice = 0;
    var scount = 0;
    var payments = [];	

    var payment_ord_amounts=[];
    var payment_ord_ids=[];

    var ifshopid=0;
    var ifebook=0;
    var has_shop_product = 0;
			
    for(var i=0 ;i < len ;i ++)
    {
           
        var ck = jQuery("#ck"+items[i].parentid).get(0);
        
        if(ck && ck.checked)
        {
            //add by lsp 2011-11-09
            var isPackage = 0;
            var orderInfo_parentid = 0;
            if( items[i].orderid != items[i].parentid )
            {
	            isPackage = 1;
	            orderInfo_parentid = items[i].parentid;
            }
            else
            {
	            isPackage = 0;
	            orderInfo_parentid = 0;
            }
            
            payment_ord_amounts[scount]=items[i].orderid + "," + items[i].Price + "," + isPackage + "," + orderInfo_parentid;
            payment_ord_ids[scount] = items[i].orderid;
            var itemPrice = parseFloat(items[i].Price)
            sumPrice += itemPrice;             
            payments[scount] = items[i].paymentid;
            
            if( parseInt(items[i].shop_id) > 0)
            {
               ifshopid=1;
               has_shop_product = 1;
            }
            
            if(items[i].ordertype==98)
            {
              ifebook=1;
            }
            
            scount++;
            
        }
    }




    //$("ckall_"+paytype).checked = (len-1 == scount );
    jQuery("#ckall_"+paytype).get(0).checked = (len-1 == scount );

    //$("count_"+paytype).innerHTML = scount;
    jQuery("#count_"+paytype).html(scount);

    //$("sumprice_"+paytype).innerHTML =  "￥" + sumPrice.toFixed(2); 
    jQuery("#sumprice_"+paytype).html("￥" + sumPrice.toFixed(2)); 

    //$("paybutton_"+paytype).setAttribute("paymentids",payments.join(','));
    jQuery("#paybutton_"+paytype).get(0).setAttribute("paymentids",payments.join(','));
    //firefox4.0
    jQuery("#paybutton_"+paytype).get(0).setAttribute("payment_ord_amounts",payment_ord_amounts.join(';'));

    jQuery("#paybutton_"+paytype).get(0).setAttribute("payment_ord_ids",payment_ord_ids.join(','));

    jQuery("#paybutton_"+paytype).get(0).setAttribute("dangdangpay",ifshopid);

    //要判断合并支付的订单里是否包含电子书。。。


    jQuery("#paybutton_"+paytype).get(0).setAttribute("ebooksymbol",ifebook);

    jQuery("#paybutton_"+paytype).get(0).setAttribute("has_shop_product",has_shop_product);



    if(scount<=1)
    {
        //$("paybutton_"+paytype).disabled =true;
        jQuery("#paybutton_"+paytype).get(0).disabled =true;
    }
    else 
    { 
      jQuery("#paybutton_"+paytype).get(0).disabled =false;

    }

}

//////////////////////////////

         
            
//////////////////////////////


//合并支付脚本

function subpay(obj,payid,platform)
{

//http://payment.dangdang.com/combine_submit.aspx payment_ids pay_type

//var paymentids = $("paybutton_"+payid).getAttribute("paymentids");

var paymentids = jQuery("#paybutton_"+payid).get(0).getAttribute("paymentids");

var amount = jQuery("#sumprice_"+payid).get(0).innerHTML.replace("￥",""); 

var order_info = jQuery("#paybutton_"+payid).get(0).getAttribute("payment_ord_amounts");

var ifshopid = jQuery("#paybutton_"+payid).get(0).getAttribute("dangdangpay");

var ebooksymbol = jQuery("#paybutton_"+payid).get(0).getAttribute("ebooksymbol");

var order_ids = jQuery("#paybutton_"+payid).get(0).getAttribute("payment_ord_ids");

//added by lsp 2012.4.17 统一平台结算
var has_shop_product = jQuery("#paybutton_"+payid).get(0).getAttribute("has_shop_product");

var outputDataUrl = "./outputData.aspx";

    var myurl = outputDataUrl;
    
    jQuery.get(myurl,{Dtype:"onlinepaycheck",Id:order_ids,d:new Date()},
        function(data)
        {
            var tex =data;	
            if(tex=='true' || tex=='True')
            {
                //可以支付
                 var submitForm = getNewSubmitForm();
                 createNewFormElement(submitForm, "pay_type", payid);
                 //createNewFormElement(submitForm, "payment_ids", paymentids);
                 createNewFormElement(submitForm, "amount", amount);
                 
                 createNewFormElement(submitForm, "is_combine", 1);
                 createNewFormElement(submitForm, "shop_id", ifshopid);
                 createNewFormElement(submitForm, "order_info", order_info);                 
                 createNewFormElement(submitForm, "ebooksymbol", ebooksymbol);
                 //added by lsp 2012.4.17 统一平台结算
                 createNewFormElement(submitForm, "has_shop_product", has_shop_product);

                 //submitForm.action= "http://payment.dangdang.com/SelectBank.aspx";
                 submitForm.action= "TipPage/paymentCombine.aspx";
                 //jQuery("#popay").submit(); 
                 
                 submitForm.submit();
            }
            else
            {
                //不可以支付
                var lin =  jQuery(m_tagbox).get(0);
                
                var text="您的订单已支付，请等待片刻";     
                jQuery(lin).html(onlinePayFailJS(text,platform)); 

                var pos = jQuery("#paybutton_" + payid).offset();

                new dragObject(lin, "handle", null, null, null, null, null, false);
                 
                lin.style.left= pos.left - 260  + "px";
                lin.style.top = pos.top + "px";	
                lin.style.zIndex = 2;			
                lin.style.display="block";	 
            }
        }
    );



 
}


function getNewSubmitForm(){
 var submitForm = document.createElement("FORM");
 document.body.appendChild(submitForm);
 submitForm.id="popay";        
 submitForm.method = "POST";
 submitForm.target="_blank" ;
 return submitForm;
}

function createNewFormElement(inputForm, elementName, elementValue){
 //var newElement = document.createElement("<input name='"+elementName+"' type='hidden'>");
 //inputForm.appendChild(newElement);
  var newElement = document.createElement("input"); 
  newElement.setAttribute("type","hidden");
  newElement.setAttribute("name",elementName);
  newElement.value = elementValue;  
  inputForm.appendChild(newElement);
 return newElement;
}


try { 
(1).toFixed(1); 
} 
catch(e) { 
Number.prototype.toFixed = function(dot) { 
with(Math){ 
var m=pow(10,Number(dot)) 
var s = (round(this*m)/m).toString(); 
} 
if(s.indexOf('.') < 0) 
s += "."; 
s += "00000000000000000000000000"; 
return s.substr(0,s.indexOf('.')+dot+1); 
} 
}



//修改订单---onmouseout='hidden_modifydiv()'
function modify_order(objectid,symbol)
{

    var lin =  jQuery("#modify_order").get(0);
    
   if(symbol=="1")
       {
         jQuery(lin).html("<div class='modify_layer'><ul><li><a name='chgreceiver'  target='_blank'  href='orderdetails.aspx?orderid="+objectid.replace("order","")+"&modify_field=connectinfo#receiver'>修改收货人信息</a></li><li><a name='chginvoice'  target='_blank'  href='orderdetails.aspx?orderid="+objectid.replace("order","")+"&modify_field=invoiceinfo#invoice'>修改发票信息</a></li></ul></div>");

       }
       else
       {
          jQuery(lin).html("<div class='modify_layer'><ul><li><a  name='chgreceiver'   target='_blank'  href='orderdetails.aspx?orderid="+objectid.replace("order","")+"&modify_field=connectinfo#receiver'>修改收货人信息</a></li></ul></div>");

       }      
 
    
    var pos = jQuery("#"+objectid).offset();

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.left - 55  + "px";
    lin.style.top = pos.top +18+ "px";			
    lin.style.display="block";	

}

function bak_modify_order(objectid,symbol)
{

       var lin =  jQuery("#modify_order").get(0);
       
       if(symbol=="1")
       {
          jQuery(lin).html("<div class='modify_layer'><ul><li><a name='chgreceiver'  target='_blank'  href='orderdetails.aspx?orderid="+objectid.replace("bak_order","")+"#receiver'>修改收货人信息</a></li><li><a  name='chginvoice'  target='_blank'  href='orderdetails.aspx?orderid="+objectid.replace("bak_order","")+"#invoice'>修改发票信息</a></li></ul></div>");
          //jQuery(lin).html("<div class='modify_layer'><ul><li><a name='chgreceiver'  target='_blank'  href='orderdetails.aspx?orderid="+objectid.replace("bak_order","")+"#receiver'>修改收货人信息</a></li></ul></div>");

       }
       else
       {
          //jQuery(lin).html("<div class='modify_layer'><ul><li><a  name='chgreceiver'  target='_blank'  href='orderdetails.aspx?orderid="+objectid.replace("bak_order","")+"#receiver'>修改收货人信息</a></li><li><a  name='chginvoice'  target='_blank'  href='orderdetails.aspx?orderid="+objectid.replace("bak_order","")+"#invoice'>修改发票信息</a></li></ul></div>");
          jQuery(lin).html("<div class='modify_layer'><ul><li><a  name='chgreceiver'  target='_blank'  href='orderdetails.aspx?orderid="+objectid.replace("bak_order","")+"#receiver'>修改收货人信息</a></li></ul></div>");

       }
   
    
 
    
    var pos = jQuery("#"+objectid).offset();

    new dragObject(lin, "handle", null, null, null, null, null, false);
     
    lin.style.left= pos.left - 30  + "px";
    lin.style.top = pos.top +18+ "px";			
    lin.style.display="block";	
  

}
//关闭 修改订单---
 function hidden_modifydiv()
 {
  var lin =  document.getElementById("modify_order");
    //var lin =  jQuery("#modify_order").get(0);
    if(lin)lin.style.display="none";
 }

//添加购物车

function cancel_to_addshopcart(orderid)
{
  //jQuery("#add_shoppingCart").get(0).style.display="block";	
  jQuery("#add_shoppingCart").get(0).src="TipPage/AddShoppingCard.aspx?orderid="+orderid+"&type=zero&productids=zero&reference_url=myorderlist"; 
}


function shownormal(orderid)
{
  jQuery("#orderlist_"+orderid+"_bak").get(0).style.display="none";
  jQuery("#orderlist_"+orderid+"_normal").get(0).style.display="block";    
}

function  showbak(orderid)
{
  jQuery("#orderlist_"+orderid+"_bak").get(0).style.display="block";
  jQuery("#orderlist_"+orderid+"_normal").get(0).style.display="none";
}




function shownormal_unitepay(orderid)
{

 
 jQuery("#orderlist_"+orderid+"_normal").get(0).className="";
 
 jQuery("#span_"+orderid+"_normal").get(0).innerHTML=jQuery("#"+orderid+"").get(0).innerHTML; 
 
 //jQuery("#orderlist_"+orderid+"_normal").live("click",goOrderDetail_unitepay(orderid));

}


/////////////////////////////////////////////////////////////////////////////////////////

function goOrderDetail_unitepay(orderid)
{
  jQuery("#orderlist_"+orderid+"_normal").get(0).onclick="";
  
  jQuery("#unitepayhtml").get(0).innerHTML+="<div id="+orderid+">"+jQuery("#span_"+orderid+"_normal").get(0).innerHTML+"</div>";
 
    var html_Str=jQuery("#list_operation_"+orderid).get(0).innerHTML; 
    
    
    
    var price=jQuery("#list_total"+orderid).get(0).innerHTML;
 
    var outputDataUrl = "./outputData.aspx";      
    var myurl = outputDataUrl;   
     
     jQuery.get(myurl,{modify:"true",Dtype:"unitpay_order_list_detail",Id:orderid,d:new Date(),operation:escape(html_Str),price:escape(price)},
         function(data)
         {
           if(data!=null)
           {
              jQuery("#orderlist_"+orderid+"_normal").get(0).className="myddorder_detail";
              
             jQuery("#span_"+orderid+"_normal").get(0).innerHTML=data;
            
           }
         });
         
        

 
}

function goOrderDetail_normal(orderid)
{
     jQuery("#orderlist_"+orderid+"_normal").get(0).onclick="";

    var html_Str=jQuery("#list_operation_"+orderid).get(0).innerHTML; 
    
    var price=jQuery("#list_total"+orderid).get(0).innerHTML;
 
    var outputDataUrl = "./outputData.aspx";      
    var myurl = outputDataUrl;   
     
     jQuery.get(myurl,{modify:"true",Dtype:"normal_order_list_detail",Id:orderid,d:new Date(),operation:escape(html_Str),price:escape(price)},
         function(data)
         {
           if(data!=null)
           {
            jQuery("#orderlist_"+orderid+"_normal").get(0).className="myddorder_detail";
             jQuery("#orderlist_"+orderid+"_normal").get(0).innerHTML=data;
           }
         });         
         
          
 
}

function goOrderDetail_package(parent_id,subOrderids)
{
  
  jQuery("#orderlist_"+parent_id+"_normal").get(0).onclick="";
   var html_Str="";    
   var arrOrderid=subOrderids.split(",");
   
//      alert(arrOrderid.length);
//      alert(arrOrderid[0]);
//      alert(arrOrderid[1]);
   
   if(arrOrderid.length>0)
   {
     for(var i=0;i<arrOrderid.length;i++)
     {
         var orderid= arrOrderid[i];
         
//         alert(orderid);
//         
//         alert(orderid+jQuery("#list_operation_"+orderid).get(0).innerHTML+"*");
         
         html_Str+=orderid+jQuery("#list_operation_"+orderid).get(0).innerHTML+"*";      
     }
   } 
    var outputDataUrl = "./outputData.aspx";      
    var myurl = outputDataUrl;   
     jQuery.get(myurl,{modify:"true",Dtype:"package_order_list_detail",Id:parent_id,d:new Date(),operation:encodeURIComponent(html_Str)},
         function(data)
         {
           if(data!=null)
           {
              jQuery("#orderlist_"+parent_id+"_normal").get(0).className="myddorder_detail";
             jQuery("#orderlist_"+parent_id+"_normal").get(0).innerHTML=data;
           }
         });           
}

//修改订单信息 js
var SHIPNAME_REGULAR_EXPRESSION='^[\\w\\u4e00-\\u9fa5]{1,20}$';
var SHIP_MB_REGULAR_EXPRESSION='^(\\d|\\(|\\)|\\-)*$';
var SHIP_TEL_REGULAR_EXPRESSION='^(\\d|\\(|\\)|\\-)*$';
var GIFT_MOBILE_REGULAR_EXPRESSION='^((13[0-9])|(15[^4,\\D])|(18[0-9]))\\d{8}$';







function showdifferentReceiverInfo()
{
  if(jQuery("#modify_receiver_info").get(0).innerHTML!="")
  {
     if(jQuery("#modify_receiver_info").get(0).innerHTML=="[关闭]")
     {
       jQuery("#modify_receiver_info").get(0).innerHTML="[修改]";   

        jQuery("#receiver_input_content").get(0).style.display="none";   
        jQuery("#receiver_label_content").get(0).style.display="block";
       
     }
     else
     {
         jQuery("#modify_receiver_info").get(0).innerHTML="[关闭]";
         jQuery("#receiver_input_content").get(0).style.display="block";
        jQuery("#receiver_label_content").get(0).style.display="none";
     }
  }
  else
  { 
    jQuery("#receiver_input_content").get(0).style.display="none";   
  }
    if($('#isOverSea').val()==="True"){
        $('#input_name').attr("readonly",true);
    }
    
}




function modify_connect_info(parent_id)
{
    var oldname;  
   var oldmobile;
   var oldtelephone;
   var oldaddress;
   
      oldname=jQuery("#label_name").get(0).innerHTML;
      oldtelephone=jQuery("#label_fixtel").get(0).innerHTML;
      oldtelephonehidden=jQuery("#label_fixtel_hidden").get(0).innerHTML;
      oldmobile=jQuery("#label_mobile").get(0).innerHTML;
      oldmobilehidden = jQuery("#label_mobile_hidden").get(0).innerHTML;
      oldaddress=jQuery("#label_address").get(0).innerHTML;
   
   
     var newname;
     var newmobile;
     var newtelephone;
     var newaddress;
 
      newname=jQuery("#input_name").get(0).value;
      newmobile=jQuery("#input_mobile").get(0).value;
      newtelephone=jQuery("#input_fixtel").get(0).value; 
      newaddress=jQuery("#input_address").get(0).value;
      
      if(newmobile==oldmobilehidden)
      {
        newmobile = oldmobile;
      }
      
      if(newtelephone==oldtelephonehidden)
      {
        newtelephone = oldtelephone;
      }
      
      if(newname=="")
      {
       jQuery("#warn_input_name").get(0).style.visibility="visible";
       return;
      }
      if(newaddress=="" || newaddress.length<3)
      {
       jQuery("#warn_input_address").get(0).style.visibility="visible";
       return;
      }
      else
      {
        jQuery("#warn_input_name").get(0).style.visibility="hidden";
      }
      
      if(newtelephone==""&&newmobile=="")
      {
       jQuery("#warn_input_tel").get(0).style.visibility="visible";
       jQuery("#warn_input_tel").get(0).innerHTML="请填写移动电话或者固定电话";
       return;
      }
      else
      {
        jQuery("#warn_input_tel").get(0).style.visibility="hidden";
      }
      
       var regMobile=new RegExp(SHIP_MB_REGULAR_EXPRESSION,'g');
       var regTel=new RegExp(SHIP_TEL_REGULAR_EXPRESSION,'g');
      
      if(!regMobile.test(newmobile))
      {
        jQuery("#warn_input_tel").get(0).style.visibility="visible";
       jQuery("#warn_input_tel").get(0).innerHTML="移动电话填写有误！";
       return;
      }
      else if(!regTel.test(newtelephone))
      {
        jQuery("#warn_input_tel").get(0).style.visibility="visible";
       jQuery("#warn_input_tel").get(0).innerHTML="固定电话填写有误！";
       return;
      }
      
    var outputDataUrl = "./outputData.aspx";      
    var myurl = outputDataUrl;  
    
     jQuery.get(myurl,{modify:"true",Dtype:"modify_connect_info",Id:parent_id,d:new Date(),oldname:escape(oldname),oldmobile:oldmobile,oldtelephone:oldtelephone,newname:escape(newname),newmobile:newmobile,newtelephone:newtelephone,oldaddress:escape(oldaddress),newaddress:escape(newaddress)},
         function(data)
         {
           if(data!=null)
           {
             //alert(data);    
                      
             var arrayStr=data.split(":");             
             if(arrayStr.length>1)
             {
               jQuery("#modify_receiver_info").get(0).innerHTML="[修改]";              
               jQuery("#input_name").get(0).value=arrayStr[0];
               jQuery("#input_fixtel").get(0).value=arrayStr[1]; 
               jQuery("#input_mobile").get(0).value=arrayStr[2];
               jQuery("#input_address").get(0).value=arrayStr[3];
               
              
              jQuery("#receiver_input_content").get(0).style.display="none";   
              
                jQuery("#label_name").get(0).innerHTML=arrayStr[0]; 
                
                if(arrayStr[1]=="")
                {
                   jQuery("#omit_digua").get(0).innerHTML="";
                  jQuery("#label_fixtel").get(0).innerHTML=""; 
                  jQuery("#label_fixtel_hidden").get(0).innerHTML="";  
                }
                else
                {
                    jQuery("#omit_digua").get(0).innerHTML="，";
                   jQuery("#label_fixtel_hidden").get(0).innerHTML=arrayStr[1];
                   jQuery("#label_fixtel").get(0).innerHTML=arrayStr[6];
                }
                             
               
                
                if(arrayStr[2]=="")
                {
                  jQuery("#omit_tudou").get(0).innerHTML="";
                  jQuery("#label_mobile").get(0).innerHTML=""; 
                  jQuery("#label_mobile_hidden").get(0).innerHTML="";      
                }
                else
                {
                   jQuery("#omit_tudou").get(0).innerHTML="，";
                   jQuery("#label_mobile_hidden").get(0).innerHTML=arrayStr[2]; 
                   jQuery("#label_mobile").get(0).innerHTML=arrayStr[5];
                }   
                if(arrayStr[3]!="")
                {
                 jQuery("#label_address").get(0).innerHTML=jQuery("#label_provincecity").get(0).innerHTML+"，"+arrayStr[4];
                }       
             
              jQuery("#receiver_label_content").get(0).style.display="block";       
            
             }
             else
             {
             
               if(data=="checked")
               {      
                 jQuery("#warn_modify_receiverinfo").get(0).style.visibility="visible";
                  jQuery("#warn_modify_receiverinfo").get(0).innerHTML="您的订单已审核，无法进行修改。";
                  jQuery("#receiver_input_content").get(0).style.display="block"; 
                   jQuery("#receiver_label_content").get(0).style.display="none";
               }
               else if(data=="false")
               {
                 jQuery("#warn_modify_receiverinfo").get(0).style.visibility="visible";
                  jQuery("#warn_modify_receiverinfo").get(0).innerHTML="修改订单发票信息失败";
                 jQuery("#receiver_input_content").get(0).style.display="block"; 
                   jQuery("#receiver_label_content").get(0).style.display="none";
               }
               else
               {
                      jQuery("#modify_receiver_info").get(0).innerHTML="[修改]";              
                      jQuery("#receiver_input_content").get(0).style.display="none";                 
                      jQuery("#receiver_label_content").get(0).style.display="block";
               }             
               
             }
              hidden_for_cancel_detail();  
              refreshBen();   
           }
         });   
}
//页面初始化
jQuery(document).ready(function(){

    if(jQuery("#label_if_gift_package").get(0)!=null && jQuery("#label_if_gift_package").get(0).innerHTML=="否")
    {
      jQuery("#package_image_show").get(0).style.display="none"; 
      
    }
    if(jQuery("#label_if_greeting_card").get(0)!=null && jQuery("#label_if_greeting_card").get(0).innerHTML=="否")
    {
      jQuery("#card_image_show").get(0).style.display="none"; 
      jQuery("#letter_show").get(0).style.display="none";
    }
    if(jQuery("#is_print_price").get(0)!=null)
    change_flag=jQuery("#is_print_price").get(0).innerHTML;
    //商品清单是否显示价格后面图片的选择
    if(change_flag=="否")
    {
      jQuery("#showImageYesOrNo").get(0).src="images/barcode_big_no.png";
    }
    else if(jQuery("#showImageYesOrNo").get(0)!=null)
    jQuery("#showImageYesOrNo").get(0).src="images/barcode_big_yes.png";
});

function showdifferentGiftInfo()
{
 if(jQuery("#modify_gift_info").get(0).innerHTML!="")
 {
    if(jQuery("#modify_gift_info").get(0).innerHTML=="[关闭]")
     {
       jQuery("#modify_gift_info").get(0).innerHTML="[修改]";   

        jQuery("#gift_input_content").get(0).style.display="none";   
        jQuery("#gift_label_content").get(0).style.display="block";
       
     }
     else
     {
         jQuery("#modify_gift_info").get(0).innerHTML="[关闭]";
         jQuery("#gift_check_warn").get(0).style.visibility="hidden";
         jQuery("#gift_input_content").get(0).style.display="block";
         // zjl
         jQuery("#input_gift_message_receiver").get(0).value=jQuery("#label_gift_message_receiver").get(0).innerHTML;
         jQuery("#input_gift_message").get(0).innerHTML=jQuery("#label_gift_message").get(0).innerHTML;
         jQuery("#input_gift_message_sender").get(0).value=jQuery("#label_gift_message_sender").get(0).innerHTML;
         jQuery("#input_gift_sender_phone").get(0).value=jQuery("#label_gift_sender_phone").get(0).innerHTML;
        
         jQuery("#gift_label_content").get(0).style.display="none";
         //显示还可以输入多少个字
         var s=jQuery("#input_gift_message").val();
         if(120-s.length>=0)
         jQuery("#mess_left").text(120-s.length);
         else
         jQuery("#mess_left").text(0);
         //默认显示 是否显示价格 2014-07-03新增
          if(jQuery("#is_print_price").get(0).innerHTML=="否")
          {
             jQuery("#select_radio_no").attr("class","simulate_radio after_click");
             jQuery("#select_radio_yes").attr("class","simulate_radio");
             jQuery("#modifyImageYesOrNo").get(0).src="images/barcode_big_no.png";
          }
          else if (jQuery("#is_print_price").get(0).innerHTML=="是")
          {
             jQuery("#select_radio_yes").attr("class","simulate_radio after_click");
             jQuery("#select_radio_no").attr("class","simulate_radio");
             jQuery("#modifyImageYesOrNo").get(0).src="images/barcode_big_yes.png";
          }  
          //是否显示图片
          if(jQuery("#label_if_gift_package1").get(0).innerHTML=="否")
            {
              jQuery("#package_image_show1").get(0).style.display="none"; 
              
            }
           if(jQuery("#label_if_greeting_card1").get(0).innerHTML=="否")
            {
              jQuery("#card_image_show1").get(0).style.display="none"; 
              jQuery("#letter_show1").get(0).style.display="none";
            } 
     }
 }
 else
 {
    jQuery("#gift_input_content").get(0).style.display="none"; 
 }
  
}
//用户选择是否显示商品价格
var change_flag=0;
function change_print(flag)  
{
     //“是”标签与“否”标签互斥
     if(flag==0)
     {
         jQuery("#select_radio_yes").attr("class","simulate_radio");
         jQuery("#select_radio_no").attr("class","simulate_radio after_click");
         jQuery("#modifyImageYesOrNo").get(0).src="images/barcode_big_no.png";
     }
     else if(flag==1)
     {
         jQuery("#select_radio_yes").attr("class","simulate_radio after_click");
         jQuery("#select_radio_no").attr("class","simulate_radio");
         jQuery("#modifyImageYesOrNo").get(0).src="images/barcode_big_yes.png";
     } 
     
     if(change_flag!=flag)
     {
      if_need_invoice=jQuery("#IsInvoiceNeed").get(0).value;
      if(flag==0 && if_need_invoice=="True")
       {
          jQuery("#gift_check_warn").get(0).style.visibility="visible";
          jQuery("#gift_check_warn").get(0).innerHTML="发票会显示商品价格，建议您 “暂不要发票”，订单完成后可以到“自助补开/合开发票“补开发票";
       }
       else 
       {
          jQuery("#gift_check_warn").get(0).style.visibility="hidden";
       }
      change_flag=flag; 
     }        
}
//取消
function gift_cancel()
{
  jQuery("#modify_gift_info").get(0).innerHTML="[修改]"; 
  jQuery("#gift_input_content").get(0).style.display="none";  
  jQuery("#gift_label_content").get(0).style.display="block"; 
}
//检查textarea长度
function checklength2()
{
   var s=jQuery("#input_gift_message").val();
   setTimeout(function(){
       if(s.length>=120) 
       {
           jQuery("#input_gift_message").val(s.substr(0,120));
           return false;
       }
       },10);
       if(120-s.length>=0)
       jQuery("#mess_left").text(120-s.length);
       else
       jQuery("#mess_left").text(0);
   
}
function expressOpenUp(i)
{
var inFo;
        if(i==0)
        {
            inFo=jQuery("#openExpressList").get(0).value;
        }
        else 
        {
            inFo=jQuery("#openExpressList"+i).get(0).value;
         }
     jQuery("#expressInfo"+i).get(0).innerHTML=inFo;
     jQuery("#packup"+i).get(0).style.display="inline-block";
     jQuery("#openup"+i).get(0).style.display="none";
}
function expressPackUp(i)
{
var inFo;
        if(i==0)
        {
            inFo=jQuery("#packExpressList").get(0).value;
        }
        else 
        {
            inFo=jQuery("#packExpressList"+i).get(0).value;
        }
     jQuery("#expressInfo"+i).get(0).innerHTML=inFo;
    jQuery("#openup"+i).get(0).style.display="inline-block";
    jQuery("#packup"+i).get(0).style.display="none";

}
//取消进度查看收起
function scheduleOpenAndPack(i)
{
     if(jQuery("#scheduleOpenPack"+i).get(0).innerHTML=="查看")
     {
         jQuery("#scheduleTable"+i).get(0).style.display="table";
         jQuery("#scheduleOpenPack"+i).get(0).innerHTML="收起";
         return;
     }
     if(jQuery("#scheduleOpenPack"+i).get(0).innerHTML=="收起")
     {
         jQuery("#scheduleTable"+i).get(0).style.display="none";
         jQuery("#scheduleOpenPack"+i).get(0).innerHTML="查看";
         return;
     }
}
//取消申请单查看收起
function cancelDetailOpenUp(i)
{
     if(jQuery("#openOrPack"+i).get(0).innerHTML=="查看")
     {
         jQuery("#cancelDetail"+i).get(0).style.display="block";
         jQuery("#openOrPack"+i).get(0).innerHTML="收起";
         return;
     }
     if(jQuery("#openOrPack"+i).get(0).innerHTML=="收起")
     {
         jQuery("#cancelDetail"+i).get(0).style.display="none";
         jQuery("#openOrPack"+i).get(0).innerHTML="查看";
         return;
     }
}
//礼品信息 保存修改
function modify_gift_info(parent_id,is_invoice_need)
{
    var oldgiftmessage;  
    var oldgiftsenderphone;
    var oldisprintprice;
   
      oldgiftmessage=jQuery("#label_gift_message").get(0).innerHTML;
      oldgiftsenderphone=jQuery("#label_gift_sender_phone").get(0).innerHTML;
      oldisprintprice=jQuery("#is_print_price").get(0).innerHTML;

   
     var newgiftmessage;
     var newgiftsenderphone;
     var newisprintprice;
      //zjl 获取新的输入
      newgiftmessagereceiver=jQuery("#input_gift_message_receiver").get(0).value;
      newgiftmessage=jQuery("#input_gift_message").get(0).value;
      newgiftmessagesender=jQuery("#input_gift_message_sender").get(0).value;
      
      newgiftsenderphone=jQuery("#input_gift_sender_phone").get(0).value;
       //获取用户的选择 是否显示价格
      if(jQuery("#select_radio_no").attr("class")=="simulate_radio after_click")
      {
         newisprintprice=0;
      }
      else newisprintprice=1;
      if(newisprintprice=="0")
      {
         jQuery("#invoice_check_warn").get(0).style.visibility="visible";
         jQuery("#invoice_check_warn").get(0).innerHTML="发票会显示商品价格，建议您 “暂不要发票”，订单完成后可以到“自助补开/合开发票“补开发票";
      }
      else 
      {
         jQuery("#invoice_check_warn").get(0).style.visibility="hidden";
      }
         
       var regMobile=new RegExp(GIFT_MOBILE_REGULAR_EXPRESSION,'g');
      
      if(newgiftsenderphone.trim(" ")!="" && (!regMobile.test(newgiftsenderphone) || newgiftsenderphone.indexOf("11")==0 || newgiftsenderphone.indexOf("12")==0))
      {
        jQuery("#warn_input_mobile").get(0).style.visibility="visible";
        jQuery("#warn_input_mobile").get(0).innerHTML="手机号码不正确，请重新输入";
       return;
      }
      else 
      {
        jQuery("#warn_input_mobile").get(0).style.visibility="hidden";
      }
      var outputDataUrl = "./outputData.aspx";      
      var myurl = outputDataUrl;  
     jQuery.post(myurl,{modify:"true",Dtype:"modify_gift_info",Id:parent_id,d:encodeURI(new Date()),oldgiftmessage:encodeURI(oldgiftmessage),oldgiftsenderphone:encodeURI(oldgiftsenderphone),oldisprintprice:encodeURI(oldisprintprice),newreceiver:encodeURI(newgiftmessagereceiver),newgiftmessage:encodeURI(newgiftmessage),newsender:encodeURI(newgiftmessagesender),newgiftsenderphone:encodeURI(newgiftsenderphone),newisprintprice:encodeURI(newisprintprice)},
         function(data)
         {
          if(data!=null)
           {      
             var arrayStr=data.split(":");             
             if(arrayStr.length>1)
             {
               jQuery("#gift_input_content").get(0).style.display="none";
               jQuery("#modify_gift_info").get(0).innerHTML="[修改]";   
               jQuery("#input_gift_sender_phone").get(0).value=arrayStr[1]; 
               jQuery("#label_gift_message_receiver").get(0).innerHTML=arrayStr[3];  
               jQuery("#label_gift_message").get(0).innerHTML=arrayStr[0];
               jQuery("#label_gift_message_sender").get(0).innerHTML=arrayStr[4];
               jQuery("#label_gift_sender_phone").get(0).innerHTML=arrayStr[1];
               jQuery("#is_print_price").get(0).innerHTML=arrayStr[2]==1?"是":"否"; 
               if(arrayStr[2]==0)
               jQuery("#modifyImageYesOrNo").get(0).src="images/barcode_big_no.png";
               else  
               {
               //alert(123);
               jQuery("#modifyImageYesOrNo").get(0).src="images/barcode_big_yes.png";
               }
               //显示 礼品信息
              jQuery("#gift_label_content").get(0).style.display="block";
                 
             }
             else
             { 
                 if(data=="checked")
               {
                 jQuery("#gift_check_warn").get(0).style.visibility="visible";
                  jQuery("#gift_check_warn").get(0).innerHTML="您的订单已审核，无法进行修改。";
                  jQuery("#gift_input_content").get(0).style.display="block"; 
                   jQuery("#gift_label_content").get(0).style.display="none";
               }
               else if(data=="false")
               {
                 jQuery("#gift_check_warn").get(0).style.visibility="visible";
                  jQuery("#gift_check_warn").get(0).innerHTML="修改订单礼品信息失败";
                 jQuery("#gift_input_content").get(0).style.display="block"; 
                   jQuery("#gift_label_content").get(0).style.display="none";
               }
               else
               {
                   jQuery("#modify_gift_info").get(0).innerHTML="[修改]";
                   jQuery("#gift_input_content").get(0).style.display="none"; 
                   jQuery("#gift_label_content").get(0).style.display="block";
               }  
             
             }   
           }
         });   
}

///////////////////////////////

function showdifferentInvoiceInfo(is_print_price,shopId,isinvoiceneed)
{
 if(jQuery("#modify_invoice_info").get(0).innerHTML!="")
 {
    if(jQuery("#modify_invoice_info").get(0).innerHTML=="[关闭]")
     {
       jQuery("#modify_invoice_info").get(0).innerHTML="[修改]";   

        jQuery("#invoice_input_content").get(0).style.display="none";   
        //jQuery("#invoice_label_content").get(0).style.display="block";
        if(isinvoiceneed==3){
                        jQuery("#einvoice_label_content").get(0).style.display="block";
                        jQuery("#invoice_label_content").get(0).style.display="none";
                   }else{
                        jQuery("#einvoice_label_content").get(0).style.display="none";
                        jQuery("#invoice_label_content").get(0).style.display="block";
                   } 
       
     }
     else
     {
         jQuery("#modify_invoice_info").get(0).innerHTML="[关闭]";
         if(is_print_price=="否")
         {
             jQuery("#invoice_check_warn").get(0).style.visibility="visible";
             jQuery("#invoice_check_warn").get(0).innerHTML="发票会显示商品价格，建议您 “暂不要发票”，订单完成后可以到“自助补开/合开发票“补开发票";
         }
         jQuery("#invoice_input_content").get(0).style.display="block";
        jQuery("#invoice_label_content").get(0).style.display="none";
        jQuery("#einvoice_label_content").get(0).style.display="none";
        if(jQuery("#elecRadio").get(0).checked)
        {
           jQuery("#elecMobile").get(0).style.display="block";
           //if(shopId==0)
           jQuery("#danwei").get(0).style.display="inline";
     }
        else 
        {
        jQuery("#danwei").get(0).style.display="inline";
 }
     }
 }
 else
 {
    jQuery("#invoice_input_content").get(0).style.display="none"; 
 }
    
}

function  clickDanWei()
{
  if(jQuery("#radio_invoice_danwei_title").get(0).checked)
  {
     jQuery("#input_invoice_title").get(0).style.visibility="visible";
     jQuery("#input_invoice_title").get(0).value=""
  }
  else
  {
     jQuery("#input_invoice_title").get(0).style.visibility="hidden";
     jQuery("#warn_title_input").get(0).style.visibility="hidden";
     jQuery("#input_invoice_title").get(0).value="";
  }
}
function  clickElecInvoice()
{
//alert(jQuery("#invoiceShopId").get(0).value);
 var arrayStr;
 var bookArrayStr;
 var nonBookArrayStr;
  if(jQuery("#elecRadio").get(0).checked)
  {
  
     jQuery("#elecMobile").get(0).style.display="block";
     
     if(jQuery("#invoiceShopId").get(0).value==0 || jQuery("#invoiceShopType").get(0).value==6)
     {
        // 新电子发票可以开单位
        jQuery("#danwei").get(0).style.display="inline";
        if(jQuery("#eInvoiceBookArray").get(0).value!=""){
            bookArrayStr=jQuery("#eInvoiceBookArray").get(0).value.split(","); 
        }
        if(jQuery("#eInvoiceNonBookArray").get(0).value!=""){
            nonBookArrayStr=jQuery("#eInvoiceNonBookArray").get(0).value.split(",");
        }
        jQuery("#eInvoiceBookContent").get(0).style.display="none";
        jQuery("#eInvoiceNonBookContent").get(0).style.display="none";
        if(bookArrayStr!=null && bookArrayStr.length>0){
            jQuery("#eInvoiceBookContent").get(0).style.display="block";
        }
        if(nonBookArrayStr!=null && nonBookArrayStr.length>0){
            jQuery("#eInvoiceNonBookContent").get(0).style.display="block";
        }
        jQuery("#invoiceContent").get(0).style.display="none";
     }else{
        arrayStr=jQuery("#eInvoiceShopArray").get(0).value.split(","); 
        jQuery("#invoiceContent").get(0).style.display="block";
     }
     
     
  }
  //选中增值税发票，不显示手机号框，绑定增值税发票的发票内容
  else if(jQuery("#vatRadio").get(0).checked)
  {
      arrayStr=jQuery("#vatInvoiceArray").get(0).value.split(",");
      jQuery("#elecMobile").get(0).style.display="none";
      jQuery("#danwei").get(0).style.display="inline";
      jQuery("#invoiceContent").get(0).style.display="block";
      jQuery("#eInvoiceBookContent").get(0).style.display="none";
      jQuery("#eInvoiceNonBookContent").get(0).style.display="none";
  } 
  //选中纸质发票，不显示手机号框，绑定纸质发票的发票内容 
  else if(jQuery("#paperRadio").get(0).checked )   
  {
      arrayStr=jQuery("#paperInvoiceArray").get(0).value.split(",");
      if(jQuery("#elecMobile").get(0)!=null)
      {
        jQuery("#elecMobile").get(0).style.display="none";
      }
      jQuery("#danwei").get(0).style.display="inline";
      jQuery("#invoiceContent").get(0).style.display="block";
      jQuery("#eInvoiceBookContent").get(0).style.display="none";
      jQuery("#eInvoiceNonBookContent").get(0).style.display="none";
  }  
  //绑定内容
     if(arrayStr!=null && arrayStr.length>=1)
     {
         jQuery("#sel_invoice_content").empty();
         
         for(var i=0;i<arrayStr.length;i++)
         {
            jQuery("#sel_invoice_content").append("<option>请选择</option>");
            jQuery("#sel_invoice_content").get(0).options[i].text=arrayStr[i];
         }
     }
     if(bookArrayStr!=null && bookArrayStr.length>=1)
     {
         jQuery("#sel_invoice_book_content").empty();
         for(var i=0;i<bookArrayStr.length;i++)
         {
            jQuery("#sel_invoice_book_content").append("<option>图书</option>");
            jQuery("#sel_invoice_book_content").get(0).options[i].text=bookArrayStr[i];
         }
     }
     if(nonBookArrayStr!=null && nonBookArrayStr.length>=1)
     {
         jQuery("#sel_invoice_nonbook_content").empty();
         for(var i=0;i<nonBookArrayStr.length;i++)
         {
            jQuery("#sel_invoice_nonbook_content").append("<option>明细</option>");
            jQuery("#sel_invoice_nonbook_content").get(0).options[i].text=nonBookArrayStr[i];
         }
     }
}
function modify_invoice_info(parent_id,isinvoiceneed)
{
   var oldinvoicetitle;  
   var oldinvoicecontent;
   var oldeinvoicebookcontent;
   var oldeinvoicenonbookcontent;
   var bookid;
   var nonbookid;
   
   if(isinvoiceneed==3){
        oldinvoicetitle=jQuery("#label_einvoice_title").get(0).innerHTML;
        bookid = jQuery("#label_book_id").get(0).innerHTML;
        nonbookid = jQuery("#label_non_book_id").get(0).innerHTML;
   }else{
        oldinvoicetitle=jQuery("#label_invoice_title").get(0).innerHTML;
        bookid = 0;
        nonbookid = 0;
   }
   oldinvoicecontent=jQuery("#label_invoice_content").get(0).innerHTML;  
   oldeinvoicebookcontent=jQuery("#label_book_invoice_content").get(0).innerHTML;
   oldeinvoicenonbookcontent=jQuery("#label_nonbook_invoice_content").get(0).innerHTML;
   
   var newinvoicetitle;  
   var newinvoicecontent;
   var neweinvoicebookcontent;
   var neweinvoicenonbookcontent;
   
   var newInvoiceType=0;
   var newVatInvoiceType=0;
   
   if(!jQuery("#radio_invoice_person_title").get(0).checked&&!jQuery("#radio_invoice_danwei_title").get(0).checked)
   {
     jQuery("#warn_title_input").get(0).style.visibility="visible";
     return;
   }
   else if(jQuery("#radio_invoice_danwei_title").get(0)!=null && jQuery("#radio_invoice_danwei_title").get(0).checked&&jQuery("#input_invoice_title").get(0).value.trim()=='')
   {
    jQuery("#warn_title_input").get(0).style.visibility="visible";
     return;
   }
   
   if(jQuery("#radio_invoice_person_title").get(0).checked)
   {
     newinvoicetitle="个人";
   }
   else
   {
    newinvoicetitle=jQuery("#input_invoice_title").get(0).value;   
   }
   
   if(jQuery("#sel_invoice_content")!=null){
        if(jQuery("#sel_invoice_content").get(0).value=="0")
        {
            jQuery("#warn_select_invoicecontent").get(0).style.visibility="visible";
            return;
        }
        else
        {
            jQuery("#warn_select_invoicecontent").get(0).style.visibility="hidden";
    
        }
        newinvoicecontent=jQuery("#sel_invoice_content").val();
   }
   if(jQuery("#sel_invoice_book_content")!=null)
   {
        neweinvoicebookcontent = jQuery("#sel_invoice_book_content").val();
   }
   
   if(jQuery("#sel_invoice_nonbook_content")!=null)
   {
        neweinvoicenonbookcontent = jQuery("#sel_invoice_nonbook_content").val();
   }
   
   if(jQuery("#paperRadio").get(0).checked)
   {
         newInvoiceType=1;
   }
   else if(jQuery("#elecRadio").get(0).checked)
   {
         newInvoiceType=3;
   }
   else if(jQuery("#vatRadio").get(0).checked)
   {
        newVatInvoiceType=1;
   }
   
   //电子发票增加手机号
   var regMobile=new RegExp(GIFT_MOBILE_REGULAR_EXPRESSION,'g');   
   var newEinvoicephone=jQuery("#inputEInvoicetel").get(0).value;
   if(jQuery("#elecRadio").get(0).checked && (newEinvoicephone==null  || newEinvoicephone=="") || newEinvoicephone.trim(" ")!="" && (!regMobile.test(newEinvoicephone) || newEinvoicephone.indexOf("11")==0 || newEinvoicephone.indexOf("12")==0))
   {
     jQuery("#warnMobile").get(0).style.visibility="visible";
     jQuery("#warnMobile").get(0).innerHTML="手机号码不正确，请重新输入";
     return;
   }
   else
   {
      jQuery("#warnMobile").get(0).style.visibility="hidden";
      jQuery("#warnMobile").get(0).innerHTML="";
   }
    var outputDataUrl = "./outputData.aspx";      
    var myurl = outputDataUrl;  
    
     jQuery.get(myurl,{modify:"true",Dtype:"modify_invoice_info",Id:parent_id,d:new Date(),oldinvoicetitle:escape(oldinvoicetitle),oldinvoicecontent:escape(oldinvoicecontent),newinvoicetitle:escape(newinvoicetitle),newinvoicecontent:escape(newinvoicecontent),isinvoiceneed:newInvoiceType,isVatNeed:newVatInvoiceType,newEinvoicePhone:newEinvoicephone,neweinvoicebookcontent:escape(neweinvoicebookcontent),neweinvoicenonbookcontent:escape(neweinvoicenonbookcontent),oldeinvoicebookcontent:escape(oldeinvoicebookcontent),oldeinvoicenonbookcontent:escape(oldeinvoicenonbookcontent),bookid:bookid,nonbookid:nonbookid},
         function(data)
         {
           if(data!=null)
           { 
             var arrayStr=data.split(":");             
             if(arrayStr.length>1)
             {            
               
               var newIsInvoiceNeed = arrayStr[2];
               
               jQuery("#modify_invoice_info").get(0).innerHTML="[修改]";  
                           
               
               if(arrayStr[0]=="个人")
               {
                 jQuery("#radio_invoice_person_title").get(0).checked;
               }
               else
               {
                 jQuery("#radio_invoice_danwei_title").get(0).checked;
                 jQuery("#input_invoice_title").get(0).value=arrayStr[0];
               }
               
               jQuery("#sel_invoice_content").get(0).value=arrayStr[1]; 
               jQuery("#sel_invoice_book_content").get(0).value=arrayStr[5]; 
               jQuery("#sel_invoice_nonbook_content").get(0).value=arrayStr[6]; 
               
               
               //alert(arrayStr[1]);
               jQuery("#invoice_input_content").get(0).style.display="none";   
              
                
                
                if(arrayStr[2]==1){
                jQuery("#label_invoice_type").get(0).innerHTML="普通发票（纸质）";
                jQuery("#label_invoice_title").get(0).innerHTML=arrayStr[0];              
                jQuery("#label_invoice_content").get(0).innerHTML=arrayStr[1];
                }
                else if(arrayStr[2]==3)
                {
                jQuery("#label_invoice_type").get(0).innerHTML="电子发票";
                jQuery("#inputEInvoicetel").get(0).value=arrayStr[4];
                jQuery("#label_einvoice_title").get(0).innerHTML=arrayStr[0];              
                jQuery("#label_book_invoice_content").get(0).innerHTML=arrayStr[5];
                jQuery("#label_nonbook_invoice_content").get(0).innerHTML=arrayStr[6];
                var content = "";
                if(arrayStr[5]!=null && arrayStr[5]!="null"){
                    content = arrayStr[5]+"/"; 
                }
                if(arrayStr[6]!=null && arrayStr[6]!="null"){
                    content = content+arrayStr[6]+"/"; 
                }
                if((arrayStr[5]==null || arrayStr[5]=="null")&&
                (arrayStr[6]==null || arrayStr[6]=="null")&&
                (arrayStr[1]!=null && arrayStr[1]!="null")){
                    content = content+arrayStr[1]+"/"; 
                }
                content = content.substring(0,content.length-1);
                jQuery("#label_book_nonbook_invoice_content").get(0).innerHTML=content;
                jQuery("#label_book_id").get(0).innerHTML = 0;
                jQuery("#label_non_book_id").get(0).innerHTML = 0;
                
                }
                else if(arrayStr[3]==1){
                jQuery("#label_invoice_type").get(0).innerHTML="增值税专用发票";
                jQuery("#label_invoice_title").get(0).innerHTML=arrayStr[0];              
                jQuery("#label_invoice_content").get(0).innerHTML=arrayStr[1];
                }
              //jQuery("#invoice_label_content").get(0).style.display="block";
                if(arrayStr[2]==3){
                        jQuery("#einvoice_label_content").get(0).style.display="block";
                        jQuery("#invoice_label_content").get(0).style.display="none";
                   }else{
                        jQuery("#einvoice_label_content").get(0).style.display="none";
                        jQuery("#invoice_label_content").get(0).style.display="block";
                   }             
             }
             else
             {
              if(data=="checked")
               {
                 //id="invoice_check_warn"  style="visibility:hidden"
                 jQuery("#invoice_check_warn").get(0).style.visibility="visible";
                 //您的订单已审核，无法进行修改。
                  jQuery("#invoice_check_warn").get(0).innerHTML="您的订单已审核，无法进行修改。";
                  jQuery("#invoice_input_content").get(0).style.display="block"; 
                   jQuery("#receiver_label_content").get(0).style.display="none";
               }
               else if(data=="false")
               {
                 jQuery("#invoice_check_warn").get(0).style.visibility="visible";
                  jQuery("#invoice_check_warn").get(0).innerHTML="修改订单发票信息失败";
                 jQuery("#invoice_input_content").get(0).style.display="block"; 
                   jQuery("#invoice_label_content").get(0).style.display="none";
                   jQuery("#einvoice_label_content").get(0).style.display="none";
               }
               else
               {
                   jQuery("#modify_invoice_info").get(0).innerHTML="[修改]";
                   jQuery("#invoice_input_content").get(0).style.display="none"; 
                   //jQuery("#invoice_label_content").get(0).style.display="block";
                   if(isinvoiceneed==3){
                        jQuery("#einvoice_label_content").get(0).style.display="block";
                        jQuery("#invoice_label_content").get(0).style.display="none";
                   }else{
                        jQuery("#einvoice_label_content").get(0).style.display="none";
                        jQuery("#invoice_label_content").get(0).style.display="block";
                   }  
               }
          
             }   
           }
         });   


}


function feedbackFakeExpress(id,orderId,custId,shopId,custEmail,receiverMobileTel,orderStatus,shippingMethodType,sendCompany,receiverName,sendDate,receiverAddress,warehouseId,deliveryDate)
{
    var sb = new StringBuilder();
    sb.append('<div class="masks" style="display: block;">');
    sb.append('<iframe style="border:none;height:100%;width:100%;opacity=0;filter:alpha(opacity=0);"></iframe>');
    sb.append('</div>');
    sb.append('<div class="jump_frame">');
    sb.append('<div class="jump_title"><span class="title">投诉快递未收到</span><a href="javascript:hidden();"><span class="close"></span></a></div>');
    sb.append('<div class="content">');
    sb.append('<div class="show_select">');
    sb.append('<div class="select_area" value="1"><a href="#" class="j_btn" onClick=javascritpt:selectComplainType("complainType1")><span class="button_select selected" id="complainType1"></span></a><span class="select_word">显示签收，但实际未收到货</span></div>');
    sb.append('<div class="select_area" value="2"><a href="#" class="j_btn" onClick=javascritpt:selectComplainType("complainType2")><span class="button_select" id="complainType2"></span></a><span class="select_word">显示配送失败，但快递未联系我</span></div>');
    sb.append('<div class="select_area" value="3"><a href="#" class="j_btn" onClick=javascritpt:selectComplainType("complainType3")><span class="button_select" id="complainType3"></span></a><span class="select_word">快递未联系我，交由他人帮我代收</span></div>');
    sb.append('</div>');
    sb.append('<div class="describe">');
    //sb.append('<input value="详细描述（50个字）" class="text_area" id="fake_express_summary" onclick=javascript:unDisplayPrompt();>');
    sb.append('<textarea  type="text" class="text_area" id="fake_express_summary" onclick=javascript:unDisplayPrompt();>详细描述（50个字）</textarea>');
    sb.append('<div class="wrong_remind" style="display:none" id="complain_wrong_input"><span class="wrong_icon"></span><span class="wrong_remind_info">输入超过50个字</span></div>');
    sb.append('</div>');
    sb.append('<div class="send_cancel">');

    sb.append('<a href=javascript:createFakeExpressFeedback("',orderId,'","',custId,'","',shopId,'","',custEmail,'","',receiverMobileTel,'","',orderStatus,'","',shippingMethodType,'","',sendCompany,'","',receiverName,'","',sendDate,'","',receiverAddress,'","',deliveryDate,'","',warehouseId,'");><span class="send sent">提交</span></a>');  
    sb.append('<a href="javascript:hidden();"><span class="send">取消</span></a>');
    sb.append('</div>');
    sb.append('</div>');
    sb.append('</div>');  
    
    var lin =  jQuery(m_tagbox).get(0);
    jQuery(lin).html(sb.getString());
    var pos = jQuery("#"+id).offset();    
    lin.style.left= pos.left+ 500 + "px";
    lin.style.top = pos.top+300 + "px";			
    lin.style.display="block";
}

function selectComplainType(complainType)
{
     var temp = $('.button_select');
     $('.button_select').removeClass('selected');
     $('#'+complainType).addClass('selected');
}

function unDisplayPrompt()
{
    
    if(document.getElementById("fake_express_summary").value=="详细描述（50个字）")
    {
        document.getElementById("fake_express_summary").value="";
    }
    
}

function createFakeExpressFeedback(orderId,custId,shopId,custEmail,receiverMobileTel,orderStatus,shippingMethodType,sendCompany,receiverName,sendDate,receiverAddress,deliveryDate,warehouseId)
{
    var summary =  document.getElementById("fake_express_summary").value;
    var complainType = $('.button_select.selected').parent().parent().attr("value");
    var outputDataUrl = "./outputData.aspx";
    var myurl = outputDataUrl;  
    jQuery.post(myurl,{modify:"true",Dtype:"createFakeExpressFeedback",orderId:orderId,custId:custId,shopId:shopId,
    summary:encodeURI(summary),custEmail:encodeURI(custEmail),receiverMobileTel:encodeURI(receiverMobileTel),
    orderStatus:orderStatus,shippingMethodType:shippingMethodType,sendCompany:encodeURI(sendCompany),
    receiverName:encodeURI(receiverName),sendDate:encodeURI(sendDate),receiverAddress:encodeURI(receiverAddress),
    warehouseId:warehouseId,complainType:complainType,deliveryDate:deliveryDate},
         function(data)
            {
               if(data=="fail!")
               {
                    jQuery("#complain_wrong_input").get(0).style.display="block";
               }
               else
               {
                    var arrayStr=data.split("|");
                    if(arrayStr.length == 2)
                    {
                        jQuery("#feedback_fake_express_entry").get(0).style.display="inline-block";
                        jQuery("#feedback_fake_express_display"+arrayStr[0]).get(0).style.display="none";
                    }
               
                    else
                    { 
                        jQuery("#feedback_fake_express_entry").get(0).style.display="none";
                        jQuery("#feedback_fake_express_display"+arrayStr[0]).get(0).style.display="inline-block";
                        jQuery("#complain_detail_content").get(0).innerHTML=arrayStr[1];
                        jQuery("#complain_detail_time").get(0).innerHTML=arrayStr[2];
                        jQuery("#complain_detail_summary").get(0).innerHTML=arrayStr[3];
                    }
                    hidden_for_cancel_detail();  
                    refreshBen();
               }
                  
            }
         );
}
function buyagain(shoppingCartParam,orderId)
{
    var outputDataUrl = "./outputData.aspx";
    var myurl = outputDataUrl;  
    var param;    
    jQuery.post(myurl,{modify:"true",Dtype:"buyagain",shoppingCartParam:encodeURI(JSON.stringify(shoppingCartParam)),referer:encodeURI(ddclick_page_tracker .__dd_url),prev_referer:encodeURI(ddclick_page_tracker .__dd_referrer),orderId:orderId},
         function(data)
            {

               param=data;

            }
         );
         
   return param; 
}

function clearMobileTel()
{
    if(document.getElementById("input_mobile").value==jQuery("#label_mobile_hidden").get(0).innerHTML)
    {
        document.getElementById("input_mobile").value="";
    }
}

function clearFixTel()
{
    if(document.getElementById("input_fixtel").value==jQuery("#label_fixtel_hidden").get(0).innerHTML)
    {
        document.getElementById("input_fixtel").value="";
    }
}
